Php sum 2 variables code example Example: sum two numbers in php <?php $x=10; $y=20; $z = $x + $y; echo "Sum of x and y : ". $z; ?>