3v4l.org

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

Function is_associative_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/FGaCQ
function name:  is_associative_array
number of ops:  17
compiled vars:  !0 = $var, !1 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        TYPE_CHECK                                  128  ~2      !0
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->5
   14     4    > > RETURN                                                   <false>
   17     5    >   INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   18     9        INIT_FCALL                                               'array_keys'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        IS_NOT_IDENTICAL                                 ~7      !1, $6
         13        VERIFY_RETURN_TYPE                                       ~7
         14      > RETURN                                                   ~7
   19    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function is_associative_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.38 ms | 958 KiB | 16 Q