3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '${first_name}, ${last_name}, ${create_date:(Y-m-d)}, ${submit_date:(Y-m-d)}'; var_export(preg_match_all('~\$\{([^:}]+)(?::([^}]+))?~', $string, $out, PREG_SET_ORDER) ? $out : 'fail');
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 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 ( 0 => array ( 0 => '${first_name', 1 => 'first_name', ), 1 => array ( 0 => '${last_name', 1 => 'last_name', ), 2 => array ( 0 => '${create_date:(Y-m-d)', 1 => 'create_date', 2 => '(Y-m-d)', ), 3 => array ( 0 => '${submit_date:(Y-m-d)', 1 => 'submit_date', 2 => '(Y-m-d)', ), )

preferences:
87.1 ms | 1470 KiB | 4 Q