johnsmith153 Posted April 23, 2011 Share Posted April 23, 2011 I have a text string and I need to find the value that appears after a certain value: Value that appears after "XXX:" "Test 123 Hello XXX: 1 Test 555"; So the value would be "1" Any ideas? Link to comment https://forums.phpfreaks.com/topic/234542-searching-in-text/ Share on other sites More sharing options...
sunfighter Posted April 24, 2011 Share Posted April 24, 2011 I am assuming you know the number XXX. <?php $string = "Test 123 Hello XXX: 1 Test 555"; $sections = explode('XXX: ', $string); $number = explode(' ', $sections[1]); echo $number[0]; ?> Take notice of the spaces. Link to comment https://forums.phpfreaks.com/topic/234542-searching-in-text/#findComment-1205558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.