aashcool198 Posted June 30, 2009 Share Posted June 30, 2009 Hi, Given a string i want to extract sub string before the first space occurs E.g in $string="php freaks"; i want to extract the first word that is "php". if $string = "your name"; i want to extract "your". How can i do it? Link to comment https://forums.phpfreaks.com/topic/164224-solved-extracting-substring/ Share on other sites More sharing options...
trq Posted June 30, 2009 Share Posted June 30, 2009 $string = "your name"; $string = explode(' ', $string, 1); echo $string[0]; Link to comment https://forums.phpfreaks.com/topic/164224-solved-extracting-substring/#findComment-866248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.