Sometimes, you want to work with just
part of a string that has been assigned. The substr function
follows the syntax:
$substring = substr([string you want to extract
from], [beginning point of extraction], [length
of the extracted value]);
For instance, to assign "Sol" to the
scalar variable $last_name you would use the following code:
$name = "Selena Sol";
$last_name = substr ($name, 7, 3);
The substr function takes the scalar
variable $name, and extracts three characters beginning with the
seventh.