3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '182507 { 6661(T) }, 182514 { 5551(T), 5553(T), 5552(T) }'; preg_match_all('/(\d+)\s*{\s*([^}]+)\s*}/', $string, $matches); $output = array(); foreach ($matches[1] as $key => $value) { $output[$key] = array_merge(array($value), preg_split('/\s*,\s*/', $matches[2][$key])); } print_r($output);

preferences:
27.12 ms | 407 KiB | 5 Q