"> What will be the output of the following PHP code? < ?php $total = "25 stude "> " /> " />
Sail E0 Webinar
Question
What will be the output of the following PHP code?
< ?php
$total = "25 students";
$more = 10;
$total = $total + $more;
echo "$total" ;
?>
Options:
A .  Error
B .  35 students
C .  35
D .  25 students
Answer: Option C


The integer value at the beginning of the original $total string is used in the calculation. However if it begins with anything but a numerical value, the value will be 0.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers