3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aliases = [ 'foo', 'bar-1', 'joomla-23', 'joom-0', ]; foreach ($aliases as &$alias) { $alias = preg_replace_callback( '~(?:-\K\d+)?$~', function ($m) { return strlen($m[0]) ? 1 + $m[0] : '-2'; }, $alias, 1 ); } var_export($aliases);
Output for git.master, git.master_jit
array ( 0 => 'foo-2', 1 => 'bar-2', 2 => 'joomla-24', 3 => 'joom-1', )

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:
37.43 ms | 408 KiB | 5 Q