3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstArray = [ "1" => [ "MemberList" => [ "0" => 100, "1" => "5d6", "2" => "5d7", ], ], "3" => [ "MemberList" => [ "0" => "5d8", "1" => 200, ], ], ]; $secondArray = [ 0 => 100, 1 => 200, ]; function custom($firstArray, $secondArray) { foreach ($firstArray as $key => $value) { if (is_array($value)) { $firstArray[$key] = custom($value, $secondArray); }else{ if(in_array($value,$secondArray)){ unset($firstArray[$key]); } } } return $firstArray; } $new = custom($firstArray, $secondArray); print_r($new);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gcs2R
function name:  (null)
number of ops:  11
compiled vars:  !0 = $firstArray, !1 = $secondArray, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, <array>
   42     2        INIT_FCALL                                               'custom'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   44     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function custom:
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 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
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/gcs2R
function name:  custom
number of ops:  24
compiled vars:  !0 = $firstArray, !1 = $secondArray, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   30     2      > FE_RESET_R                                       $4      !0, ->21
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->21
          4    >   ASSIGN                                                   !3, ~5
   31     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~7, ->14
   32     7    >   INIT_FCALL_BY_NAME                                       'custom'
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $9      
         11        ASSIGN_DIM                                               !0, !3
         12        OP_DATA                                                  $9
   31    13      > JMP                                                      ->20
   34    14    >   INIT_FCALL                                               'in_array'
         15        SEND_VAR                                                 !2
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $10     
         18      > JMPZ                                                     $10, ->20
   35    19    >   UNSET_DIM                                                !0, !3
   30    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $4
   39    22      > RETURN                                                   !0
   40    23*     > RETURN                                                   null

End of function custom

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.63 ms | 1013 KiB | 16 Q