3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GetTheAnswer() { return 1; } function GetOtherAnswer() { if(GetTheAnswer() = 2) { return 4; } else { return 5; } } global $theAnswer = GetTheAnswer(); $otherAnswer = GetOtherAnswer(); $averageAnswer = ($theAnswer + $otherAnswer) / 2; echo $averageAnswer;
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '=', expecting ',' or ';' in /in/mT5TR on line 15
Process exited with code 255.
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
Fatal error: Can't use function return value in write context in /in/mT5TR on line 8
Process exited with code 255.

preferences:
172.19 ms | 1395 KiB | 28 Q