get part from string php code example
Example 1: php get part of string
substr ( $string , $start , $length );
/**Returns the extracted part of string;
*or FALSE on failure, or an empty string
*/
Example 2: php string take part
<?php
$str = "Africa Beautiful!";
echo substr($str, 0, 6); // Outputs: Africa
echo substr($str, 0, -10); // Outputs: Beautiful
echo substr($str, 0); // Outputs: Africa Beautiful!
?>