079 - Substr -- extract small string from an original string
 world. The world is nice
e world is nice
 nice
Hello worl
Hello world. The world is nic
ld is n
<?php // 079 - Substr -- extract small string from an original string echo "</br><span class='myheading'>079 - Substr -- extract small string from an original string</span></br>"; $str = "Hello world. The world is nice"; $newstr1 = substr($str, 5); // make string form index 5 till end $newstr2 = substr($str, 15); // make form index 15 $newstr3 = substr($str, -5); // start -5 index to end $newstr4 = substr($str, 0, 10); // start 0 to 10 index $newstr5 = substr($str, 0, -1); // start form 0 to -1 index(last) $newstr6 = substr($str, -10, -3); // start -10 index to -3 index echo '<pre>'; print_r($newstr1); echo '</pre>'; echo '<pre>'; print_r($newstr2); echo '</pre>'; echo '<pre>'; print_r($newstr3); echo '</pre>'; echo '<pre>'; print_r($newstr4); echo '</pre>'; echo '<pre>'; print_r($newstr5); echo '</pre>'; echo '<pre>'; print_r($newstr6); echo '</pre>'; ?>