3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_value() { // If there were no values returned, return false. if (func_num_args() == 0) { return false; } // Get all the values supplied $values = func_get_args(); $random = array_rand($values); return $values[$random]; } echo "First random try: ".random_value(1, 5, 4, 5); echo "\n\n"; echo "Second random try: ".random_value(9, 8); echo "\n\n"; echo "Third random try: ".random_value(3, 10, 6, 2, 4, 7);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b63WX
function name:  (null)
number of ops:  27
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'random_value'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 5
          3        SEND_VAL                                                 4
          4        SEND_VAL                                                 5
          5        DO_FCALL                                      0  $0      
          6        CONCAT                                           ~1      'First+random+try%3A+', $0
          7        ECHO                                                     ~1
   16     8        ECHO                                                     '%0A%0A'
   17     9        INIT_FCALL                                               'random_value'
         10        SEND_VAL                                                 9
         11        SEND_VAL                                                 8
         12        DO_FCALL                                      0  $2      
         13        CONCAT                                           ~3      'Second+random+try%3A+', $2
         14        ECHO                                                     ~3
   18    15        ECHO                                                     '%0A%0A'
   19    16        INIT_FCALL                                               'random_value'
         17        SEND_VAL                                                 3
         18        SEND_VAL                                                 10
         19        SEND_VAL                                                 6
         20        SEND_VAL                                                 2
         21        SEND_VAL                                                 4
         22        SEND_VAL                                                 7
         23        DO_FCALL                                      0  $4      
         24        CONCAT                                           ~5      'Third+random+try%3A+', $4
         25        ECHO                                                     ~5
         26      > RETURN                                                   1

Function random_value:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b63WX
function name:  random_value
number of ops:  13
compiled vars:  !0 = $values, !1 = $random
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FUNC_NUM_ARGS                                    ~2      
          1        IS_EQUAL                                                 ~2, 0
          2      > JMPZ                                                     ~3, ->4
    6     3    > > RETURN                                                   <false>
   10     4    >   FUNC_GET_ARGS                                    ~4      
          5        ASSIGN                                                   !0, ~4
   11     6        INIT_FCALL                                               'array_rand'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !1, $6
   12    10        FETCH_DIM_R                                      ~8      !0, !1
         11      > RETURN                                                   ~8
   13    12*     > RETURN                                                   null

End of function random_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.47 ms | 1407 KiB | 18 Q