3v4l.org

run code in 300+ PHP versions simultaneously
<?php $category = array( 1 => array( 'id' => 1, 'parentID' => 0, 'name' => 'SUV auto parts' ), 2 => array( 'id' => 2, 'parentID' => 1, 'name' => 'Engine Related' ), 3 => array( 'id' => 3, 'parentID' => 2, 'name' => 'Spark Plugs' ), 4 => array( 'id' => 4, 'parentID' => 2, 'name' => 'Engine Oil' ), 5 => array( 'id' => 5, 'parentID' => 1, 'name' => 'Body related' ), 6 => array( 'id' => 6, 'parentID' => 0, 'name' => 'Sedan auto parts' ), 7 => array( 'id' => 7, 'parentID' => 6, 'name' => 'Engine Related' ), ); $parentId = 2; // set the parentID foreach($category as $key => $value) { if($value['parentID'] == $parentId) { echo '<pre>'; print_r($value); // print matching records echo '</pre>'; } }
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [id] => 3 [parentID] => 2 [name] => Spark Plugs ) </pre><pre>Array ( [id] => 4 [parentID] => 2 [name] => Engine Oil ) </pre>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
108.66 ms | 405 KiB | 5 Q