3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isIndexNormalized($array){ $recreate = []; foreach($array as $index => $value){ $recreate[$index] = $value; } $recreate[] = "foo"; $array[] = "foo"; return $recreate === $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/pcBI8
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        UNSET_DIM                                                !0, 3
   17     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                                                 
   18     8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  'x'
   19    10        INIT_FCALL                                               'var_dump'
         11        IS_IDENTICAL                                     ~5      !0, <array>
         12        SEND_VAL                                                 ~5
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   21    15        ECHO                                                     '%0A%0A%0A%0A'
   23    16        ASSIGN                                                   !0, <array>
   24    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                                                 
   25    23        ASSIGN_DIM                                               !0
         24        OP_DATA                                                  'x'
   26    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
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/pcBI8
function name:  isIndexNormalized
number of ops:  16
compiled vars:  !0 = $array, !1 = $recreate, !2 = $value, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $5      !0, ->8
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->8
          4    >   ASSIGN                                                   !3, ~6
    6     5        ASSIGN_DIM                                               !1, !3
          6        OP_DATA                                                  !2
    5     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $5
    8     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  'foo'
    9    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  'foo'
   10    13        IS_IDENTICAL                                     ~11     !1, !0
         14      > RETURN                                                   ~11
   11    15*     > RETURN                                                   null

End of function isindexnormalized

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.09 ms | 1007 KiB | 16 Q