3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Example array $array = array( 'egg' => true, 'cheese' => false, 'hair' => 765, 'goblins' => null, 'ogres' => 'no ogres allowed in this array' ); // Loose checking var_dump(in_array(null, $array)); var_dump(in_array(false, $array)); var_dump(in_array(765, $array)); var_dump(in_array(763, $array)); var_dump(in_array('egg', $array)); var_dump(in_array('cheese', $array)); var_dump(in_array('WHATEVER', $array)); var_dump(in_array(array(), $array)); // Strict checking echo "now with strict\n"; var_dump(in_array(null, $array, true)); var_dump(in_array(false, $array, true)); var_dump(in_array(765, $array, true)); var_dump(in_array(763, $array, true)); var_dump(in_array('egg', $array, true)); var_dump(in_array('hhh', $array, true)); var_dump(in_array(array(), $array, true)); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) now with strict bool(true) bool(true) bool(true) bool(false) bool(false) bool(false) bool(false)