Mega Code Archive

 
Categories / Php / Strings
 

Using several functions together to extract a portion of a string

<?php $test_string="testing testing Username:Michele Bond"; $position=strpos($test_string,"Username:"); $start=$position+strlen("Username:"); echo "$test_string<br />"; echo "$position<br />"; echo substr($test_string,$start); ?>