3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/', $name, $m)) { $segments = array($m['base']); while (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $m['extra'], $m)) { echo $m['segment']."\n"; } }

preferences:
67.03 ms | 402 KiB | 5 Q