3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x=10; $y=2; function myEcho($x,$y){ echo $x+$y; } function myReturn($x,$y){ return $x+$y; } echo myEcho($x,$y); //12 echo "<br/>"; echo myEcho($x,$y)+$x; //1210 echo "<br/>"; echo $x+myEcho($x,$y); //1210 echo "<br/>"; echo myEcho($x,$y)+myEcho($x,$y); //12120 echo "<br/>"; echo myEcho($x,$y)+myReturn($x,$y); // 1212 echo "<br/>"; echo myEcho($x,$y)+myReturn($x,$y)+myEcho($x,$y); //121212 echo "<br/>"; echo gettype(myEcho($x,$y)); //12NULL echo "<br/>"; echo gettype(myReturn($x,$y)); //integer echo "<br/>";
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
12<br/>1210<br/>1210<br/>12120<br/>1212<br/>121212<br/>12NULL<br/>integer<br/>