0

I have a bit of PHP where I want to store a URL in a string. The code itself seems fine, but for some reason, when I use the characters $sectionId=, it causes problems, in fact, it alters $sectionId= and changes it to §ionId=.

If I misspell it to $secionId then it works fine.

The full url SHOULD be:

http://url.com/file.php?appKey=$appkey&storeId=$storeid&sectionId=$sectionid&v=3

but when I do an echo $myURL; on it, it gives me:

http://url.com/file.php?appKey=$appkey&storeId=$storeid§ionId=$sectionid&v=3

Notice the §ionId= instead of $sectionId=.

Can anyone help me with this? It seems like basic PHP, but I don't understand why it just doesnt like those 4 or 5 characters in a row!!

Thanks.

1
  • What version of php are you using, and do you have a locale specified that could be causing a unicode conversion? Commented May 20, 2011 at 2:55

1 Answer 1

1

Are you echoing it right to HTML? Well, some over-helpful browsers will do character conversions without being asked explicitly to with a semicolon; all you need to do is run it through htmlentities or replace all &s with & and it will display correctly.

Sign up to request clarification or add additional context in comments.

2 Comments

Hmm, so what will happen if i just process the string as normal? Is it ONLY when I echo the string that the browser is doing a conversion?
Yes, most likely. Using it within PHP will be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.