3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Token { public $fix = null; // this would be a function pointer in c++ // ctr public function Token($MyFix) { $this->fix = $MyFix; } } //Create a class $AFix = function(){ return 'foo'; }; $token = new Token($AFix) ; // call echo $token->fix();
based on nqYc4
Output for 7.0.0 - 7.3.0alpha1
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Token has a deprecated constructor in /in/1tWDS on line 3 Fatal error: Uncaught Error: Call to undefined method Token::fix() in /in/1tWDS:16 Stack trace: #0 {main} thrown in /in/1tWDS on line 16
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Call to undefined method Token::fix() in /in/1tWDS:16 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined method Token::fix() in /in/1tWDS on line 16
Process exited with code 255.