logo CodeStepByStep logo

marshall_mathers

Language/Type: PHP string

Given the following variable declarations:

// index       0123456789012345678901234
$s1         = "Snoop Dogg";
$s2         = "Marshall 'Eminem' Mathers";
$s3         = $s2.substr(18);
$book       = "Art & Science of PHP";

Give the results of the following expressions. Make sure to indicate a value of the proper type (e.g. strings in " " quotes).

strlen($s1)
strlen($s2)
strpos($s1, "o")
strpos($s2, "x")
substr($s1, 6, 9)
substr($s2, 21)
substr($book, 6, 12)
strtolower($s3)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.