I have the following URL:
http://sub.mysite.com/store/?store=Fine+Ting&storeid=3726&test1=value1&test2=value2
Using print_r(parse_url($url))
gives me this:
Array (
[scheme] => http
[host] => sub.mysite.com
[path] => /store/
[query] => store=Fine+Ting&
[fragment] => 038;storeid=3726&test1=value1&test2=value2
)
According to the documentation I should only get fragment
after the hashmark #.
Why then is parse_url
returning fragment? Shouldn't that be in [query]
?
You have a problem with you url, the ampersand is encoded in htmlentities (&
). Therefore parse_str
thinks, the fragment is starting there.
Try using html_entity_decode before passing the url to parse_url
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With