3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/^(?:([0-9]+) X,)? ?(?:([0-9]+) Y,)?(?: Z)?$/m'; $str = <<<_ 66 X, 55 Y, Z 66 X, 55 Y, 66 X, Z 55 Y, Z 66 X, 55 Y, \n _; preg_match_all($re, $str, $matches, PREG_SET_ORDER); foreach ($matches as $match) { unset($match[0]); foreach (['null', 'null'] as $key => $value) { if (!isset($match[$key + 1]) || $match[$key + 1] === '') $match[$key + 1] = $value; } echo implode(" - ", $match), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 35
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 35
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 26
Branch analysis from position: 22
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 27
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/IIWBM
function name:  (null)
number of ops:  37
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $match, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%5E%28%3F%3A%28%5B0-9%5D%2B%29+X%2C%29%3F+%3F%28%3F%3A%28%5B0-9%5D%2B%29+Y%2C%29%3F%28%3F%3A+Z%29%3F%24%2Fm'
    4     1        ASSIGN                                                   !1, '66+X%2C+55+Y%2C+Z%0A66+X%2C+55+Y%2C%0A66+X%2C+Z%0A55+Y%2C+Z%0A66+X%2C%0A55+Y%2C%0A%0A'
   14     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 2
          7        DO_ICALL                                                 
   16     8      > FE_RESET_R                                       $9      !2, ->35
          9    > > FE_FETCH_R                                               $9, !3, ->35
   17    10    >   UNSET_DIM                                                !3, 0
   18    11      > FE_RESET_R                                       $10     <array>, ->27
         12    > > FE_FETCH_R                                       ~11     $10, !4, ->27
         13    >   ASSIGN                                                   !5, ~11
   19    14        ADD                                              ~13     !5, 1
         15        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !3, ~13
         16        BOOL_NOT                                         ~15     ~14
         17      > JMPNZ_EX                                         ~15     ~15, ->22
         18    >   ADD                                              ~16     !5, 1
         19        FETCH_DIM_R                                      ~17     !3, ~16
         20        IS_IDENTICAL                                     ~18     ~17, ''
         21        BOOL                                             ~15     ~18
         22    > > JMPZ                                                     ~15, ->26
   20    23    >   ADD                                              ~19     !5, 1
         24        ASSIGN_DIM                                               !3, ~19
         25        OP_DATA                                                  !4
   18    26    > > JMP                                                      ->12
         27    >   FE_FREE                                                  $10
   22    28        INIT_FCALL                                               'implode'
         29        SEND_VAL                                                 '+-+'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $21     
         32        ECHO                                                     $21
         33        ECHO                                                     '%0A'
   16    34      > JMP                                                      ->9
         35    >   FE_FREE                                                  $9
   23    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
258.58 ms | 1016 KiB | 15 Q