I need to remove these ‘ & ‘ characters from each property of a php object
I tried the code below but it’s not working…what am I missing?
thanks dudes
foreach($query_item as $key => $value)
{
$key = str_replace(' & ',' & ',$value);
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should refer to $value by reference, and modify it in place:
The alternative would be to reference the item within the object using $key:
I’ll also point out htmlentities(), while we’re on the subject of replacing & with &.