3v4l.org

run code in 300+ PHP versions simultaneously
<?php $assoc = array( "a" => 1, "b" => 0, 0 => 0 ); function is_assoc($array){ $sorted = ksort($array); $sorted = array_keys($sorted); return !ctype_digit(implode('', $sorted)); } echo is_assoc($assoc); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A1mAM
function name:  (null)
number of ops:  6
compiled vars:  !0 = $assoc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'is_assoc'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   17     5      > RETURN                                                   1

Function is_assoc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A1mAM
function name:  is_assoc
number of ops:  19
compiled vars:  !0 = $array, !1 = $sorted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'ksort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   11     5        INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   12     9        INIT_FCALL                                               'ctype_digit'
         10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 ''
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                         $7      
         16        BOOL_NOT                                         ~8      $7
         17      > RETURN                                                   ~8
   13    18*     > RETURN                                                   null

End of function is_assoc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.16 ms | 1398 KiB | 22 Q