3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sales_people = array( '2' => array( 'states' => array('NY', 'NJ', 'CT', 'MA', 'VT', 'ME'), 'codes' => array('CA1', 'US7', 'UT9') ), '5' => array( 'states' => array('FL', 'GA', 'SC', 'NC', 'TN'), 'codes' => array('VA4', 'VA8', 'VA3') ) ); function searchSubsets($sets, $needle): ?int { foreach ($sets as $id => $haystacks) { foreach ($haystacks as $haystack) { if (in_array($needle, $haystack)) { return $id; } } } return null; } var_export(searchSubsets($sales_people, 'CT'));
Output for git.master, git.master_jit, rfc.property-hooks
2

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:
64.57 ms | 982 KiB | 4 Q