3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = trim(' {555555 123456 123456} {666666 654321 654321} {777777 123456 123456} '); $items = []; if (preg_match_all('/^{[\d]{1,} ([\d]{1,}) ([\d]{1,})}$/m', $foo, $matches)) { $items = array_reduce( array_slice($matches, 1), fn(array $found, array $match) => array_merge($found, $match), [] ); } var_dump($items);
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array(6) { [0]=> string(6) "123456" [1]=> string(6) "654321" [2]=> string(6) "123456" [3]=> string(6) "123456" [4]=> string(6) "654321" [5]=> string(6) "123456" }

preferences:
98.64 ms | 1275 KiB | 4 Q