3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "aa | bb | \"cc | dd\" | 'ee | ff'"; preg_match_all("~(?|\"([^\"]*)\"|'([^']*)'|([^|'\"]+))(?:\s*\|\s*|\z)~", $string, $matches); print_r(array_map(function($x) {return trim($x);}, $matches[1]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E2h7S
function name:  (null)
number of ops:  16
compiled vars:  !0 = $string, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'aa+%7C+bb+%7C+%22cc+%7C+dd%22+%7C+%27ee+%7C+ff%27'
    4     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%7E%28%3F%7C%22%28%5B%5E%22%5D%2A%29%22%7C%27%28%5B%5E%27%5D%2A%29%27%7C%28%5B%5E%7C%27%22%5D%2B%29%29%28%3F%3A%5Cs%2A%5C%7C%5Cs%2A%7C%5Cz%29%7E'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          9        SEND_VAL                                                 ~4
         10        FETCH_DIM_R                                      ~5      !1, 1
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
         15      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E2h7S
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.4 ms | 1001 KiB | 17 Q