3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'inputs', 'app', 'post', 'server', ]; echo in_array('inputs', $array) ? '"inputs" is in the array...' : ''; echo "\n"; echo in_array(0, $array) ? '0 is also in the array!' : '0 is NOT in the array!'; echo "\n"; echo in_array(0, $array, true) ? '0 is also in the array!' : '0 is NOT in the array!'; echo "\n"; echo in_array(1, $array) ? '1 is also in the array!' : '1 is NOT in the array!'; echo "\n"; print_r(array_keys($array, 0));
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, 8.5.0 - 8.5.3
"inputs" is in the array... 0 is NOT in the array! 0 is NOT in the array! 1 is NOT in the array! Array ( )
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
"inputs" is in the array... 0 is also in the array! 0 is NOT in the array! 1 is NOT in the array! Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 )

preferences:
93.53 ms | 1631 KiB | 4 Q