PHP Tutorial : Substract part of string with substr

Hello,

I didn’t posted for a long time because I am simply stucked into finding a subject. I made a search into my own blog and I saw that (miraculous btw) I didn’t writed yet about substr function which helps you to print only a part of a string – substract it!

<?php
$stringIs = "mystring";
$substract = substr($stringIs, 0, 3);
print $subtract; //this will print my

?>

First you declare the string you want substracted, then first number means from where to start and the last no. means where to finish.

Taddaaa!

One Response to “PHP Tutorial : Substract part of string with substr”

  1. Baruch de Spinoza Says:

    would it be too much to say that the world is in devil’s hand aslong as man does not trust in his own ratio?


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>