Start New Discussion Reply to this Discussion how can i escape double quotes from a string in php?
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!
Related Article: PHP Double Array Coding
is a PHP discussion thread by Sunday1290 that has 1 reply and was last updated 5 months ago.
Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
try this
$replace1 =str_replace('hreflang="'.$arr['variantslang1hid'].'" lang="'.$arr['variantslang1hid'].'"','hreflang="'.$arr['variantslang1'].'" lang="'.$arr['variantslang1'].'"',$replace1);
vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2
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..
Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2
what?
you have not escaped "" 's n your reply.
Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
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
vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2
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!
Virangya
Junior Poster
122 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page generated in 0.0746 seconds
using 2.71MB