3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=2; $b=0; $c=7; $d=0; $e=3; $array = [$a, $b, $c, $d, $e]; $filtered_array = array_filter($array); $random_index = array_rand($filtered_array); echo $filtered_array[$random_index];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iVTCn
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $e, !5 = $array, !6 = $filtered_array, !7 = $random_index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 2
    4     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, 7
    6     3        ASSIGN                                                   !3, 0
    7     4        ASSIGN                                                   !4, 3
    9     5        INIT_ARRAY                                       ~13     !0
          6        ADD_ARRAY_ELEMENT                                ~13     !1
          7        ADD_ARRAY_ELEMENT                                ~13     !2
          8        ADD_ARRAY_ELEMENT                                ~13     !3
          9        ADD_ARRAY_ELEMENT                                ~13     !4
         10        ASSIGN                                                   !5, ~13
   10    11        INIT_FCALL                                               'array_filter'
         12        SEND_VAR                                                 !5
         13        DO_ICALL                                         $15     
         14        ASSIGN                                                   !6, $15
   11    15        INIT_FCALL                                               'array_rand'
         16        SEND_VAR                                                 !6
         17        DO_ICALL                                         $17     
         18        ASSIGN                                                   !7, $17
   13    19        FETCH_DIM_R                                      ~19     !6, !7
         20        ECHO                                                     ~19
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.63 ms | 1000 KiB | 15 Q