3v4l.org

run code in 500+ PHP versions simultaneously
<?php /** * Check if variable is a numeric array. * * @param array|mixed $var * @return bool */ $b=array(1,2); function is_numeric_array($var): bool { if (!is_array($var)) { return false; } $keys = array_keys($var); return ($keys === array_keys($keys)); } var_dump(is_numeric_array($b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I7dMN
function name:  (null)
number of ops:  8
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                       !0, <array>
   21     1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'is_numeric_array'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        SEND_VAR                                                     $2
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

Function is_numeric_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I7dMN
function name:  is_numeric_array
number of ops:  17
compiled vars:  !0 = $var, !1 = $keys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        TYPE_CHECK                                      128  ~2      !0
          2        BOOL_NOT                                             ~3      ~2
          3      > JMPZ                                                         ~3, ->5
   15     4    > > RETURN                                                       <false>
   18     5    >   INIT_FCALL                                                   'array_keys'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $4      
          8        ASSIGN                                                       !1, $4
   19     9        INIT_FCALL                                                   'array_keys'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                             $6      
         12        IS_IDENTICAL                                         ~7      !1, $6
         13        VERIFY_RETURN_TYPE                                           ~7
         14      > RETURN                                                       ~7
   20    15*       VERIFY_RETURN_TYPE                                           
         16*     > RETURN                                                       null

End of function is_numeric_array

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
216.6 ms | 2215 KiB | 16 Q