3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $food = array('fruits' => array('item1'=>'orange', 'item2'=>'banana', 'item3'=>'apple'), 'veggie' => array('item1'=>'carrot', 'item2'=>'collard', 'item3'=>'pea')); print_r($food); foreach($food as $item) { echo $item["item1"]."<br >"; } if(in_array('orange', $food, true)){ echo 'in array'; } else { echo 'not in array'; } $test_array=null; echo count($test_array)."count of food "; echo strlen("");
based on nJ8Yo
Output for 7.2.0
Array ( [fruits] => Array ( [item1] => orange [item2] => banana [item3] => apple ) [veggie] => Array ( [item1] => carrot [item2] => collard [item3] => pea ) ) orange<br >carrot<br >not in array Warning: count(): Parameter must be an array or an object that implements Countable in /in/RJJOr on line 16 0count of food 0
Output for 5.3.21 - 7.1.10
Array ( [fruits] => Array ( [item1] => orange [item2] => banana [item3] => apple ) [veggie] => Array ( [item1] => carrot [item2] => collard [item3] => pea ) ) orange<br >carrot<br >not in array0count of food 0