3v4l.org

run code in 300+ PHP versions simultaneously
<?php $masks = ['1224*', '543*', '321*', '12245*', '5*', '122488*']; sort($masks); $needle = rtrim(array_shift($masks), '*'); $keep[] = $needle; foreach ($masks as $mask) { if (strpos($mask, $needle) !== 0) { $needle = rtrim($mask, '*'); $keep[] = $needle; } } // now $keep only contains: ['1224', '321', '5'] $numbers = ['122456789', '123456788', '321876543234567', '55555555555555555', '987654321']; var_export( preg_grep('~^(?:' . implode('|', $keep) . ')~', $numbers) );
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => '122456789', 2 => '321876543234567', 3 => '55555555555555555', )

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:
29.99 ms | 405 KiB | 5 Q