To extract a sequence of characters from a string, use PHP's substr() function.
This function takes the following parameters:
The third parameter is optional; if left out, substr() extracts from the start position to the end of the string
<?php $myString = "Hello, world!"; echo substr( $myString, 0, 5 ) . " \n "; echo substr( $myString, 7 ) . " \n "; echo substr( $myString, -1 ) . " \n "; echo substr( $myString, -5, -1 ) . " \n "; ?>// w w w. j a v a 2 s . c om