3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [0, 3, 10, 5, 6, 9, 2, 7, 1, 4, 8, 11]; $deletes = [3, 5]; foreach (array_diff($array, $deletes) as $value) { $result[] = array_reduce( $deletes, function ($carry, $item) use ($value) { return $carry - ($value > $item); }, $value ); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/SHWZ4
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $deletes, !2 = $value, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_diff'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->18
          7    > > FE_FETCH_R                                               $7, !2, ->18
    7     8    >   INIT_FCALL                                               'array_reduce'
    8     9        SEND_VAR                                                 !1
    9    10        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         11        BIND_LEXICAL                                             ~9, !2
   11    12        SEND_VAL                                                 ~9
   12    13        SEND_VAR                                                 !2
    7    14        DO_ICALL                                         $10     
         15        ASSIGN_DIM                                               !3
   12    16        OP_DATA                                                  $10
    6    17      > JMP                                                      ->7
         18    >   FE_FREE                                                  $7
   15    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
         22      > 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/SHWZ4
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $carry, !1 = $item, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   10     3        IS_SMALLER                                       ~3      !1, !2
          4        SUB                                              ~4      !0, ~3
          5      > RETURN                                                   ~4
   11     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.7 ms | 1008 KiB | 16 Q