3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCount(&$a) { return count($a); } $cnt = getCount( $foo ); var_dump($cnt); // и если сделать так $cnt = getCount( $foo['bar'] ); var_dump($cnt); //EOF//
based on runMq
Output for 8.0.0
Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /in/EV9Fh:3 Stack trace: #0 /in/EV9Fh(5): getCount(NULL) #1 {main} thrown in /in/EV9Fh on line 3
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.24, 7.4.0 - 7.4.13
Warning: count(): Parameter must be an array or an object that implements Countable in /in/EV9Fh on line 3 int(0) Warning: count(): Parameter must be an array or an object that implements Countable in /in/EV9Fh on line 3 int(0)
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30, 7.0.0 - 7.0.27, 7.1.0 - 7.1.20
int(0) int(0)
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/EV9Fh on line 14
Process exited with code 255.