I am running a code which takes a youtube url as input and i am using str_replace on it.
$title = str_replace('watch?v=', 'embed/', $title);
but the replacement just wont happen. I keep getting the same string back.
The youtube url im using as of now is http://www.youtube.com/watch?v=iwQx9gw2NfM
what mistake am I making ? The the serch string is CLEARLY present in the url but it wont get replaced.
Or is there a better way to do this ?
EDIT: The code works fine... I was trying to replace the wrong variable