3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'FILE-F01-E1-S01.pdf', 'FILE-F01-E1-S02.pdf', 'FILE-F01-E1-S03.pdf', 'FILE-F01-E1-S04.pdf', 'FILE-F01-E1-S05.pdf', 'FILE-F02-E1-S01.pdf', 'FILE-F02-E1-S02.pdf', 'FILE-F02-E1-S03.pdf', "TESTFILE-F01-E1-S03.pdf" ]; $parts = explode('-', $array[0]); array_pop($parts); $fileBeginning = implode('-', $parts); $secondArray = array_filter($array, function ($x) use ($fileBeginning) { return substr($x, 0, strlen($fileBeginning)) === $fileBeginning; }); print_r($secondArray);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => FILE-F01-E1-S01.pdf [1] => FILE-F01-E1-S02.pdf [2] => FILE-F01-E1-S03.pdf [3] => FILE-F01-E1-S04.pdf [4] => FILE-F01-E1-S05.pdf )

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.15 ms | 401 KiB | 8 Q