I have written a PHP function like this. <?php function add($x,$y) { echo $x." + ".$y." = "; echo $x+$y."<br />"; } echo add(12,13); echo add(121,131); ?> result: ----------------- 12 + 13 = 25 121 + 131 = 252 ---------------- Now If I change the above function like this function add($x,$y) { echo $x." + ".$y." = ".$x+$y."<br />"; } result: ------------------- 25 252 ------------------ Why it is $x." + ".$y." = " part has no effect. I tried on a WAMP server localhost.
function add($x,$y) { echo $x." + ".$y." = ".($x+$y)."<br />"; } PHP: there must be a bracket whenever addition/subtraction/(mathematical functions Maybe) is used.