logo CodeStepByStep logo


Language/Type: PHP expressions string
Author: Melissa Hovik (on 2018/01/05)

Trace the evaluation of the following expressions, and give their resulting values. Assume the variables $a and $b are defined in the environment such that $a = 1 and $b = 2. Make sure to give a value of the appropriate type (such as including a " " quotes around a string).

$a + $b
$a . $b
$a . "." . $b
$a + $b . "foo"
"foo" . $b * 3
"$a" . $a
"$a" . '$b'
"$a \$a or {$b}?"

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.