3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 62, 9, [5, 16, 45], [11, 21, 25, 32, 50], [4, 23, 37, 57], [13, 15, 18, 22, 27, 30] ]; function getRandomValueRecursive($array) { $data = $array[array_rand($array)]; if (is_array($data)) { $data = getRandomValueRecursive($data); } return $data; } var_export(getRandomValueRecursive($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JVBK3
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'getrandomvaluerecursive'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function getrandomvaluerecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/JVBK3
function name:  getRandomValueRecursive
number of ops:  14
compiled vars:  !0 = $array, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'array_rand'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        FETCH_DIM_R                                      ~3      !0, $2
          5        ASSIGN                                                   !1, ~3
   15     6        TYPE_CHECK                                  128          !1
          7      > JMPZ                                                     ~5, ->12
   16     8    >   INIT_FCALL_BY_NAME                                       'getRandomValueRecursive'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !1, $6
   18    12    > > RETURN                                                   !1
   19    13*     > RETURN                                                   null

End of function getrandomvaluerecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.34 ms | 1005 KiB | 16 Q