fork download
  1. <?php
  2. $str = '123=one; two;45=three=four;6=five;';
  3. if (preg_match_all('~(\d+)=(.+?);(?=\d|$)~', $str, $arr))
  4. print_r($arr);
  5. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => 123=one; two;
            [1] => 45=three=four;
            [2] => 6=five;
        )

    [1] => Array
        (
            [0] => 123
            [1] => 45
            [2] => 6
        )

    [2] => Array
        (
            [0] => one; two
            [1] => three=four
            [2] => five
        )

)