sum of 2 var in php code example
Example 1: addition in php
<?php
$x=15;
$y=30;
$z=$x+$y;
echo "Sum: ",$z;
?>
Example 2: add two numbers as string in php
$num = "3.14";
$int = (int)$num;
$float = (float)$num;
<?php
$x=15;
$y=30;
$z=$x+$y;
echo "Sum: ",$z;
?>
$num = "3.14";
$int = (int)$num;
$float = (float)$num;