3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function save($a, $b, $c=NULL) { echo "save something"; return 1; // id } } class D extends C { function saveD($a, $b){ return parent::save($a,$b); } } class X extends D { function save($a, $b, $c){ // do little processing with $c return $this->saveD($a,$b); } } $x = new X(); $x->save(1,2,"aaaa");
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Declaration of X::save($a, $b, $c) must be compatible with C::save($a, $b, $c = null) in /in/hUeXf on line 17
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of X::save($a, $b, $c) should be compatible with C::save($a, $b, $c = NULL) in /in/hUeXf on line 17 save something
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 X::save($a, $b, $c) should be compatible with C::save($a, $b, $c = NULL) in /in/hUeXf on line 21 save something
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Strict Standards: Declaration of X::save() should be compatible with C::save($a, $b, $c = NULL) in /in/hUeXf on line 21 save something
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Strict Standards: Declaration of X::save() should be compatible with that of C::save() in /in/hUeXf on line 21 save something
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
save something

preferences:
267.3 ms | 402 KiB | 330 Q