3v4l.org

run code in 300+ PHP versions simultaneously
<?php $j[] = 'ma_1_49812_5318.jpg'; $j[] = 'ma_1_49812_5319.jpg'; $j[] = 'ma_1_49813_5320.jpg'; $j[] = 'ma_1_49813_5321.jpg'; $result = []; foreach ($j as $filename) { $groupBy = preg_replace('/_[^_]+$/', '', $filename); if (!isset($ref[$groupBy])) { $ref[$groupBy] = $filename; $result[] = &$ref[$groupBy]; } else { $ref[$groupBy] .= "|$filename"; } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'ma_1_49812_5318.jpg|ma_1_49812_5319.jpg', 1 => 'ma_1_49813_5320.jpg|ma_1_49813_5321.jpg', )

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