3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [2,3,4,5,6,7]; $b = [11,64,2,5,8]; $c = 7; var_dump( array_intersect ( $a, $b )); var_dump( array_intersect ( $a, (array)$c )); var_dump( count( $c ));
based on R1RBv
Output for 7.2.0
array(2) { [0]=> int(2) [3]=> int(5) } array(1) { [5]=> int(7) } Warning: count(): Parameter must be an array or an object that implements Countable in /in/bpjI1 on line 9 int(1)
Output for 5.4.10 - 7.1.10
array(2) { [0]=> int(2) [3]=> int(5) } array(1) { [5]=> int(7) } int(1)
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/bpjI1 on line 3
Process exited with code 255.