正则表达式,如何将内容文本转换为数组?

[code]
 [1] text 1
 [2] text 2
 [3] text 3
[/code]

so I need that the values text 1, text 2, text 3 was as array.

My troubles in this:

$matches = preg_match_all( "/^\[\d{1,3}\](.*)/", $content, $tags );

It's returns me an array with empty values:

Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

)
1

How to fix it or make it good?

[code]
 [1] text 1
 Different content here
 [2] text 2 Another dif..
 [3] Also something either
  to be continues!
[/code]

With multiline it will return only a text 1 instead of all code in array's first element

Array
(
    [0] => Array
        (
            [0] => [1] text 1


            [1] => [2] text 2 Another dif..

            [2] => [3] Also something either

        )

    [1] => Array
        (
            [0] =>  text 1


            [1] =>  text 2 Another dif..

            [2] =>  Also something either

        )

)
1

And other elements too will be only by a first string result.

You should drop the anchor ^ and change (.*) to a look-ahead set ([^[]*) instead.

$s =<<<EOM
[code]
 [1] text 1
 Another line
 [2] text 2
 And another line too
 [3] text 3
[/code]
EOM;

preg_match_all("/\[\d{1,3}\]([^[]*)/", $s, $tags);

print_r($tags);