3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reduce_unwanted_colors = function (&$arr) use (&$reduce_unwanted_colors) { $rand_key = array_rand($arr); if ($arr[$rand_key] != 'blue') { unset($arr[$rand_key]); $reduce_unwanted_colors($arr); } }; $arr = ['red', 'green', 'blue', 'orange', 'yellow']; $reduce_unwanted_colors($arr); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/05inn
function name:  (null)
number of ops:  11
compiled vars:  !0 = $reduce_unwanted_colors, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          1        BIND_LEXICAL                                             ~2, !0
          2        ASSIGN                                                   !0, ~2
   12     3        ASSIGN                                                   !1, <array>
   13     4        INIT_DYNAMIC_CALL                                        !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
   14     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/05inn
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $arr, !1 = $reduce_unwanted_colors, !2 = $rand_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    5     2        INIT_FCALL                                               'array_rand'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
    6     6        FETCH_DIM_R                                      ~5      !0, !2
          7        IS_NOT_EQUAL                                             ~5, 'blue'
          8      > JMPZ                                                     ~6, ->13
    7     9    >   UNSET_DIM                                                !0, !2
    8    10        INIT_DYNAMIC_CALL                                        !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   10    13    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.2 ms | 1011 KiB | 15 Q