3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface bbqesq { function printSoda(); } class bbq implements bbqesq { var $soda; function printSoda(){ echo $this->soda; } } function doPrint(bbqesq $e) { $e->printSoda(); } $k = new bbq; $k->soda = 8675309; doPrint($e);
based on OuL59
Output for 7.0.0 - 7.3.1
Notice: Undefined variable: e in /in/nSoMD on line 23 Fatal error: Uncaught TypeError: Argument 1 passed to doPrint() must implement interface bbqesq, null given, called in /in/nSoMD on line 23 and defined in /in/nSoMD:15 Stack trace: #0 /in/nSoMD(23): doPrint(NULL) #1 {main} thrown in /in/nSoMD on line 15
Process exited with code 255.
Output for 5.3.20 - 5.6.38
Notice: Undefined variable: e in /in/nSoMD on line 23 Catchable fatal error: Argument 1 passed to doPrint() must implement interface bbqesq, null given, called in /in/nSoMD on line 23 and defined in /in/nSoMD on line 15
Process exited with code 255.