PHP PCREs . /, :
preg_split('/[0-9]+\.\s/', $subject);
, PHP [] .
:
Array
(
[0] =>
[1] => [subject]
[2] => [another subject]
[3] => [a third subject]
)
(unset($subjects[0])).
preg_match_all :
$str = "1. [subject] 2. [another subject] 3. [a third subject]";
preg_match_all('/\[([^\]]+)\]/', $str, $matches);
$subjects = $matches[1];
// or $subject = $matches[0]; if you want to include the brackets.
$matches
Array
(
[0] => Array
(
[0] => [subject]
[1] => [another subject]
[2] => [a third subject]
)
[1] => Array
(
[0] => subject
[1] => another subject
[2] => a third subject
)
)