⊗ppPmBsFr 22 of 447 menu

Fractions in PHP

PHP also supports decimal fractions. In them, the integer and fractional parts are separated by a dot. See the example:

<?php $a = 0.5; echo $a; // outputs 0.5 ?>

See another example:

<?php $a = 0.5 + 0.5; echo $a; // outputs 1 ?>

Store the number 1.5 in the variable $a, and the number 0.75 in the variable $b. Find the sum of the values of these variables and output it to the screen.

byenru