3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array( array("PROPERTIES" => array(1122), "QUANTITY" => "11"), array("PROPERTIES" => array(1123), "QUANTITY" => "12") ); function getQuantityById($id) { global $arr; foreach ($arr as $item) { if ($item["PROPERTIES"][0] == $id) return $item["QUANTITY"]; } return null; } echo getQuantityById(1123);
Output for 4.3.0 - 7.1.0
12