Code: Select all
$line = 'NAME(23): John Smith';
$data = preg_split('/NAME(\(d\))*: (.)+/', $line, -1, PREG_SPLIT_OFFSET_CAPTURE);I need the output to always be two array elements:
Code: Select all
$data[0] = 23; // Optional number may not exist but this field should always be set NULL or not
$data[1] = "John Smith"Thanks