alexville Posted February 10, 2008 Share Posted February 10, 2008 Hey, Say I have this in a variable : http://ca.youtube.com/watch?v=uSH5GOevgOk&feature=dir and I want to get rid of the ending &feature=dir and get an output of this in a variable: http://ca.youtube.com/watch?v=uSH5GOevgOk How could I do this? Link to comment https://forums.phpfreaks.com/topic/90375-how-would-i-get-rid-of-something-in-a-variable/ Share on other sites More sharing options...
paul2463 Posted February 10, 2008 Share Posted February 10, 2008 <?php $string = "http://ca.youtube.com/watch?v=uSH5GOevgOk&feature=dir"; $start = explode("&",$string); //splits the string into an array on the & sign echo $start[0];//echoes out all before the first mention of an & ?> Link to comment https://forums.phpfreaks.com/topic/90375-how-would-i-get-rid-of-something-in-a-variable/#findComment-463346 Share on other sites More sharing options...
alexville Posted February 10, 2008 Author Share Posted February 10, 2008 thanks! it worked perfectly! Link to comment https://forums.phpfreaks.com/topic/90375-how-would-i-get-rid-of-something-in-a-variable/#findComment-463430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.