3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'aaa|45.85[u]52.22 - 43.75 - 36.5[d]25.75', 'bbb|238.4[u]345.45 - 24.1[d]13.85 - 56.4[d]56' ]; $result = []; foreach ($data as $element) { if (preg_match("#^([^|]+)\|(?:[^\]]+\])?(\S+) - (?:[^\]]+\])?(\S+) - (?:[^\]]+\])?(\S+)$#", $element, $matches)) { unset($matches[0]); $result[array_shift($matches)] = array_combine(['num1', 'num2', 'num3'], $matches); } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/AtqWq
function name:  (null)
number of ops:  26
compiled vars:  !0 = $data, !1 = $result, !2 = $element, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
    9     2      > FE_RESET_R                                       $6      !0, ->21
          3    > > FE_FETCH_R                                               $6, !2, ->21
   10     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%23%5E%28%5B%5E%7C%5D%2B%29%5C%7C%28%3F%3A%5B%5E%5C%5D%5D%2B%5C%5D%29%3F%28%5CS%2B%29+-+%28%3F%3A%5B%5E%5C%5D%5D%2B%5C%5D%29%3F%28%5CS%2B%29+-+%28%3F%3A%5B%5E%5C%5D%5D%2B%5C%5D%29%3F%28%5CS%2B%29%24%23'
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !3
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->20
   11    10    >   UNSET_DIM                                                !3, 0
   12    11        INIT_FCALL                                               'array_shift'
         12        SEND_REF                                                 !3
         13        DO_ICALL                                         $8      
         14        INIT_FCALL                                               'array_combine'
         15        SEND_VAL                                                 <array>
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $10     
         18        ASSIGN_DIM                                               !1, $8
         19        OP_DATA                                                  $10
    9    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $6
   15    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.23 ms | 1009 KiB | 17 Q