3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create new stdClass with numeric attribute, stored as string. $bla = new stdClass; $bla->{"1012"} = "Value 1"; $bla->{1012} = "Value 2"; // Convert to array $bla = (array) $bla; if (!isset($bla[1012])) { // ISSET fails, because it is now "1012" instead of 1012 var_dump($bla); $bla[1012] = "Value 4"; } var_dump($bla); echo json_encode($bla);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/LLZeC
function name:  (null)
number of ops:  25
compiled vars:  !0 = $bla
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    5     3        ASSIGN_OBJ                                               !0, '1012'
          4        OP_DATA                                                  'Value+1'
    6     5        ASSIGN_OBJ                                               !0, '1012'
          6        OP_DATA                                                  'Value+2'
    9     7        CAST                                          7  ~6      !0
          8        ASSIGN                                                   !0, ~6
   10     9        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !0, 1012
         10        BOOL_NOT                                         ~9      ~8
         11      > JMPZ                                                     ~9, ->17
   12    12    >   INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   13    15        ASSIGN_DIM                                               !0, 1012
         16        OP_DATA                                                  'Value+4'
   16    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
   17    20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $13     
         23        ECHO                                                     $13
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.55 ms | 1395 KiB | 17 Q