3v4l.org

run code in 500+ PHP versions simultaneously
<?php $test = [ ['id' => 13, 'pets' => 8], ['id' => 15, 'pets' => 8], ['id' => 16, 'pets' => 10], ['id' => 17, 'pets' => 9], ['id' => 18, 'pets' => 10], ['id' => 19, 'pets' => 10], ['id' => 20, 'pets' => 0], ['id' => 21, 'pets' => 8], ['id' => 22, 'pets' => 9], ['id' => 23, 'pets' => 4], ['id' => 24, 'pets' => 0], ['id' => 40, 'pets' => 8], ['id' => 43, 'pets' => 2], ]; echo implode( ',', array_map( fn() => $test[array_rand($test)]['id'], range(1, 5) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5SHLu
function name:  (null)
number of ops:  14
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        INIT_FCALL                                                   'array_map'
   22     2        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          3        BIND_LEXICAL                                                 ~2, !0
          4        SEND_VAL                                                     ~2
   23     5        INIT_FCALL                                                   'range'
          6        SEND_VAL                                                     1
          7        SEND_VAL                                                     5
          8        DO_ICALL                                             $3      
          9        SEND_VAR                                                     $3
   21    10        DO_ICALL                                             $4      
   19    11        FRAMELESS_ICALL_2                implode             ~5      '%2C', $4
   23    12        ECHO                                                         ~5
   25    13      > 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/5SHLu
function name:  {closure:/in/5SHLu:22}
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   BIND_STATIC                                                  !0
          1        INIT_FCALL                                                   'array_rand'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        FETCH_DIM_R                                          ~2      !0, $1
          5        FETCH_DIM_R                                          ~3      ~2, 'id'
          6      > RETURN                                                       ~3
          7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.4 ms | 1331 KiB | 16 Q