3v4l.org

run code in 300+ PHP versions simultaneously
<?php $postcodes = array( 'NE', 'NG', 'PE' ); function matches($needle, $postcodes) { foreach ($postcodes as $postcode) { if ($postcode === substr($needle, 0, strlen($postcode))) { return true; } } return false; } foreach (array('NE1', 'RG', 'PE') as $needle) { printf( "%s %s\n", $needle, matches($needle, $postcodes) ? 'matches' : 'does not match' ); } /* NE1 matches RG does not match PE matches */
Output for git.master, git.master_jit, rfc.property-hooks
NE1 matches RG does not match PE matches

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:
60.23 ms | 401 KiB | 8 Q