
Originally Posted by
fredmintah
Hello gurus,
Below is the sample code I will like you to help me out with. Please forgive me if you think I should know this. I am really new to the PHP world. Thank for you understanding.
PHP Code:
$fname = "name";
$lname = "format";
$tel = "4778546";
# Using the substr() function we start at position 0 and go to position
# 3 to get the first three letters of the $fname variable.
$one = substr($fname,0,3); // what function to extract nam from the $fname variable
# Same thing here
$two = substr($tel,3,3); // what function to extract 854 from the $lname variable
# Same thing here
$three = substr($lname,3,3); // what function to extract mat from the $tel variable
$id = $one . $two . $three;
print $id;
Bookmarks