To explain the substr function the best is to look at it this way:
substr(STRING_YOU_ARE_LOOKING_IN, starting_position, how_many_chars_from_starting_position);
These positions are ordered numbers of the letters in the word.
Letter H = 0
e = 1
l = 2
l = 3
o = 4
So, for example:
$search="Hello to all of you!";
echo substr($search,0,4); //this would print out "Hell"
//if you don't use the second number (how_many_chars_from_starting_position),
//program will automatically take the substring FROM the starting position till the //end of the word
echo substr($search, 3); //Considering that letter with index number 3 (remember we are counting from 0 as a first letter) is letter "l", this would print out
"lo to all of you!".