-1

how are you today..?

hi all...

I found something odds, and very tricky..

echo "&currency"; //return ¤cy

echo "&ethnic"; //return ðnic

Why is this happened..? its affected on URL query.

it seemed that the string is encoded ASCII, how to fix it..?

this is the loop.. tried to replace & to & amp ;

foreach($pars as $key => $val) $param .= "&".$key."=".$val;

but its having so many errors...

Thankyou.

3
  • 1. You need to HTML-encode the & character as &. 2. how are you today - brilliant Commented Nov 23, 2021 at 1:48
  • so.. only need to change & into & ..? how brilliant..!!! Commented Nov 23, 2021 at 1:51
  • foreach($pars as $key => $val) $param .= "&".$key."=".$val; ..... so many errors... Commented Nov 23, 2021 at 2:07

1 Answer 1

0

You can find this symbol here https://dev.w3.org/html5/html-author/charref.

Use urlencode() to solve your problem with URL query.

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

3 Comments

just a simple string, url already encoded but parameter query has changed, tried to replace with & in my function, its return many errors.. something like this... foreach($pars as $key => $val) $param .= "&".$key."=".$val;
http_build_query not solve this..
http_build_query(), if used properly, absolutely does solve this. stackoverflow.com/a/62055171/2943403

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.