3v4l.org

run code in 500+ PHP versions simultaneously
<?php class questions { public function index( $from = null ) { if ( $from != 'test' ) { return $this->test(); } return 'sth'; } public function test(){ function myfunc(){} return $this->index(__FUNCTION__); } } class tags extends questions { public function index () { return parent::index(); } } $obj = new tags; echo $obj->index();
Output for 8.5.0 - 8.5.3
Fatal error: Declaration of tags::index() must be compatible with questions::index($from = null) in /in/Y5KVq on line 25 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Fatal error: Declaration of tags::index() must be compatible with questions::index($from = null) in /in/Y5KVq on line 25
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of tags::index() should be compatible with questions::index($from = NULL) in /in/Y5KVq on line 25 Fatal error: Cannot redeclare myfunc() (previously declared in /in/Y5KVq:16) in /in/Y5KVq on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of tags::index() should be compatible with questions::index($from = NULL) in /in/Y5KVq on line 29 Fatal error: Cannot redeclare myfunc() (previously declared in /in/Y5KVq:16) in /in/Y5KVq on line 16
Process exited with code 255.

preferences:
89.89 ms | 1542 KiB | 3 Q