hi, i've been trying to solve this but no luck. This is my code

$replace1 =str_replace('hreflang=\"'.$arr['variantslang1hid'].'\" lang=\"'.$arr['variantslang1hid'].'\"','hreflang=\"'.$arr['variantslang1'].'\" lang=\"'.$arr['variantslang1'].'\"',$replace1);

it should replace but no. i'm not escaping "" properly. how can i solve this? help much appreciated!

Recommended Answers

All 6 Replies

try this

$replace1 =str_replace('hreflang="'.$arr['variantslang1hid'].'" lang="'.$arr['variantslang1hid'].'"','hreflang="'.$arr['variantslang1'].'" lang="'.$arr['variantslang1'].'"',$replace1);

try this

$replace1 =str_replace('hreflang="'.$arr['variantslang1hid'].'" lang="'.$arr['variantslang1hid'].'"','hreflang="'.$arr['variantslang1'].'" lang="'.$arr['variantslang1'].'"',$replace1);

thanks for your reply, but i what to escape too..

what?

you have not escaped "" 's n your reply.

i don't get it, why would you escape double quotes(") when it's not even conflicting with your string statement, you wrap them with single quotes, not double quotes that would cause conflict that's why you had to escape them

i don't get it, why would you escape double quotes(") when it's not even conflicting with your string statement, you wrap them with single quotes, not double quotes that would cause conflict that's why you had to escape them

yeah you makes sense. i was the one who messed it up in my head :D. thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.