Header ("Content-type:text/html;charset=utf-8");
$a = 10;
$b = ' 60 ';
echo "$a + $b =". $a + $b. "
";
echo "$a-$b =". $a-$b. "
";
echo "$a
$b = ". $a$b. "
";
echo "$a/$b =". $a/$b. "
";
?>
The last page output has the following values:
70
-50
10*60=600
10/60=0.16666666666667
How are these values derived?
Reply content:
Header ("Content-type:text/html;charset=utf-8");
$a = 10;
$b = ' 60 ';
echo "$a + $b =". $a + $b. "
";
echo "$a-$b =". $a-$b. "
";
echo "$a$b =". $a$b. "
";
echo "$a/$b =". $a/$b. "
";
?>
The last page output has the following values:
70
-50
10*60=600
10/60=0.16666666666667
How are these values derived?
echo "$a + $b =". $a + $b. "
"; execution result (+-) is the same level of execution order left to right)
"$a+$b=" => '10+60='"$a+$b=".$a => '10+60=10'("$a+$b=".$a) + $b => intval('10+60=10') + intval($b) => 10+60 =>70
Click to view PHP operator precedence
$a is the integer type, stored in PHP as Long, $b is a string, when doing arithmetic operations to cast to an integer, the division of the decimal number is stored in double, the rest is mathematical transport forget
Basic operation: Subtraction
In this case, the string is automatically converted into an shaping engagement operation