$string = “sertech”;
and i want to only get the sertech part this is how i would show the first 9 letters:
PHP Code:
$string = "sertech";
$string = substr($string, 0, 9);
echo $string;;
?>
the best way to lear is to try it. open notepad, copy and paste this code and save the file was sertech.php upload to your php site, then open it with your browser.
PHP Code:
$string = array();
$string [0] = substr("sertech", 0, -1); // returns "sertecham"
$string [1] = substr("sertech", 0, 9); // returns "sertech"
$string [2] = substr("sertech", 0, -3); // returns "sertech"
$string [3] = substr("sertech", 9); // returns "ama"
$string [4] = substr("sertech", -3); // returns "ama"
echo '
‘;
print_r($string );
echo ‘
';
?>
if you want to learn more you can visit the official php site:
Http://Www.Php.Net/Manual/En/Function.Substr.Php
1 comments:
I enjoyed reading your blog. Keep it that way. ddipyvwlsflcdtkv
Post a Comment