i have an array of URLs, but these URL contains the unwanted string "&" so many times..
How can i remove & from the strings of that array ???
4 replies to this topic
#1
Posted 12 March 2011 - 10:23 PM
|
|
|
#2
Posted 12 March 2011 - 10:29 PM
There are a few ways, probably the most simple is this:
$cleanArray = array();
foreach($strings as $string) {
$cleanArray[] = str_replace("&", "&", $string);
}You can use urldecode as well although that will replace all %foo or &bar with their respective symbols.
Edited by Alexander, 12 March 2011 - 10:56 PM.
Typographical error
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 12 March 2011 - 10:54 PM
There is some problem with this function..
if i am using & for replacing & nothing changes & if i use something else like "abc" instead of & for replacing & it works..
it means whenever & is in the link the amp; also comes automatically..:c-mad:
if i am using & for replacing & nothing changes & if i use something else like "abc" instead of & for replacing & it works..
it means whenever & is in the link the amp; also comes automatically..:c-mad:
#4
Posted 12 March 2011 - 10:57 PM
I am not sure what you are referring to, take this working example:
Ideone.com | Online PHP Interpreter & Debugging Tool
It resolves the encoded & successfully. Is that what you meant?
Ideone.com | Online PHP Interpreter & Debugging Tool
It resolves the encoded & successfully. Is that what you meant?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#5
Posted 12 March 2011 - 11:45 PM
hey thanx i am using var_dump instead of print_r:c-biggrin:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









