3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isIndexNormalized($array){ $array[] = 'aux'; return (array_key_last($array) + 1) === count($array); } // ------- $array = [0, 1, 2, 3]; unset($array[3]); var_dump(isIndexNormalized($array)); $array[] = "x"; var_dump([0, 1, 2, "x"] === $array, $array); echo "\n\n\n\n"; // ------- $array = [0, 1, 2]; var_dump(isIndexNormalized($array)); $array[] = "x"; var_dump([0, 1, 2, "x"] === $array, $array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SZWhi
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        UNSET_DIM                                                !0, 3
   12     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'isindexnormalized'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   13     8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  'x'
   14    10        INIT_FCALL                                               'var_dump'
         11        IS_IDENTICAL                                     ~5      !0, <array>
         12        SEND_VAL                                                 ~5
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   16    15        ECHO                                                     '%0A%0A%0A%0A'
   18    16        ASSIGN                                                   !0, <array>
   19    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'isindexnormalized'
         19        SEND_VAR                                                 !0
         20        DO_FCALL                                      0  $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                                 
   20    23        ASSIGN_DIM                                               !0
         24        OP_DATA                                                  'x'
   21    25        INIT_FCALL                                               'var_dump'
         26        IS_IDENTICAL                                     ~11     !0, <array>
         27        SEND_VAL                                                 ~11
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function isindexnormalized:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SZWhi
function name:  isIndexNormalized
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  'aux'
    5     3        INIT_FCALL                                               'array_key_last'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ADD                                              ~3      $2, 1
          7        COUNT                                            ~4      !0
          8        IS_IDENTICAL                                     ~5      ~3, ~4
          9      > RETURN                                                   ~5
    6    10*     > RETURN                                                   null

End of function isindexnormalized

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.16 ms | 1008 KiB | 17 Q