3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST = array("person" => array( 1 => array("id" => 1, "name" => "bob"), 2 => array("id" => 2, "name" => "jim") ) ); foreach ($_POST["person"] as $data) { foreach ($data as $value) { if ( $value == 1) { echo $data["name"],"\n"; } } }
Output for 7.0.0 - 7.0.23, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.24, 7.4.0 - 7.4.12, 8.0.0
bob