3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface intf{ public function setVar($a); public function getVar(); } class A implements intf{ private $A; public function setVar($a){ $this->A=$a; } public function getVar(){ return $this->A; } } class B extends Abs{ private $B; public function setVar($a){ $this->B=$a; } public function getVar(){ return $this->B; } } abstract class Abs{ abstract public function setVar($a); abstract public function getVar(); public function make_double_var($a){ return $a*2; } } $A=new A(); $B=new B(); $A->setVar(2); echo 'Class A'.$A->getVar(); $B->setVar(4); echo 'Class B'.$B->getVar(); echo 'Class B'.$B->get_double($B->getVar());
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Class A2Class B4 Fatal error: Uncaught Error: Call to undefined method B::get_double() in /in/DiGKc:44 Stack trace: #0 {main} thrown in /in/DiGKc on line 44
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Class A2Class B4 Fatal error: Call to undefined method B::get_double() in /in/DiGKc on line 44
Process exited with code 255.

preferences:
206.37 ms | 401 KiB | 287 Q