galvin Posted January 13, 2011 Share Posted January 13, 2011 If I was pulling back data from MySQL that was like this "monkeys / dogs / cats", how would I grab just "monkeys" from that using PHP? In other words, I want to grab all text until a "/" is seen. Link to comment https://forums.phpfreaks.com/topic/224264-function-to-get-text-up-to-a-certain-character/ Share on other sites More sharing options...
Garethp Posted January 13, 2011 Share Posted January 13, 2011 $array = explode("/", $data); $monkey = $array[0]; http://php.net/manual/en/function.explode.php Link to comment https://forums.phpfreaks.com/topic/224264-function-to-get-text-up-to-a-certain-character/#findComment-1158687 Share on other sites More sharing options...
galvin Posted January 13, 2011 Author Share Posted January 13, 2011 Beautiful thanks! Link to comment https://forums.phpfreaks.com/topic/224264-function-to-get-text-up-to-a-certain-character/#findComment-1158689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.