3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file1 = 'orders1.txt'; $file1CounterPart = 'order1-items.txt'; $file2 = 'orders2.txt'; $file2CounterPart = 'order2-items.txt'; $files = [$file1, $file1CounterPart, $file2, $file2CounterPart]; var_dump($files); function passes(array $files) { $orders = array_filter($files, function ($file) { return preg_match('/^orders\d+\.txt$/', $file); }); $orderItems = array_filter($files, function ($file) { return preg_match('/^order\d+\.txt$/', $file); }); var_dump($orders); var_dump($orderItems); } // var_dump( // [ // [ // 'orders1.txt', // 'order1-items.txt' // ], // [ // 'orders2.txt', // 'order2-items.txt' // ] // ] // );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDbie
function name:  (null)
number of ops:  13
compiled vars:  !0 = $file1, !1 = $file1CounterPart, !2 = $file2, !3 = $file2CounterPart, !4 = $files
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'orders1.txt'
    4     1        ASSIGN                                                   !1, 'order1-items.txt'
    6     2        ASSIGN                                                   !2, 'orders2.txt'
    7     3        ASSIGN                                                   !3, 'order2-items.txt'
   11     4        INIT_ARRAY                                       ~9      !0
          5        ADD_ARRAY_ELEMENT                                ~9      !1
          6        ADD_ARRAY_ELEMENT                                ~9      !2
          7        ADD_ARRAY_ELEMENT                                ~9      !3
          8        ASSIGN                                                   !4, ~9
   13     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !4
         11        DO_ICALL                                                 
   40    12      > RETURN                                                   1

Function passes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDbie
function name:  passes
number of ops:  20
compiled vars:  !0 = $files, !1 = $orders, !2 = $orderItems
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmDbie%3A16%240'
   18     4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
   16     6        ASSIGN                                                   !1, $4
   20     7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !0
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmDbie%3A20%241'
   22    10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
   20    12        ASSIGN                                                   !2, $7
   24    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   25    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   27    19      > RETURN                                                   null

End of function passes

Function %00%7Bclosure%7D%2Fin%2FmDbie%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDbie
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5Eorders%5Cd%2B%5C.txt%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   18     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmDbie%3A16%240

Function %00%7Bclosure%7D%2Fin%2FmDbie%3A20%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDbie
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5Eorder%5Cd%2B%5C.txt%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   22     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmDbie%3A20%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.95 ms | 1400 KiB | 19 Q