3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); $a["foo"] = "bar"; $a["baz"] = "quux"; $a["100"] = "zimbabwe"; echo "\$a is an associative map with some things in it: "; var_export($a); echo "\n\n"; $keys = array_keys($a); echo "It has these keys: "; var_export($keys); echo "\n\n"; echo "But there was a silent string-int coercion when we added an object to the container using a string key that looked like an int\n\n"; var_dump( is_string($keys[2]) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tlrkg
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 'foo'
          2        OP_DATA                                                  'bar'
    5     3        ASSIGN_DIM                                               !0, 'baz'
          4        OP_DATA                                                  'quux'
    6     5        ASSIGN_DIM                                               !0, 100
          6        OP_DATA                                                  'zimbabwe'
    8     7        ECHO                                                     '%24a+is+an+associative+map+with+some+things+in+it%3A+'
    9     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   10    11        ECHO                                                     '%0A%0A'
   12    12        INIT_FCALL                                               'array_keys'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !1, $7
   14    16        ECHO                                                     'It+has+these+keys%3A+'
   15    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   16    20        ECHO                                                     '%0A%0A'
   18    21        ECHO                                                     'But+there+was+a+silent+string-int+coercion+when+we+added+an+object+to+the+container+using+a+string+key+that+looked+like+an+int%0A%0A'
   20    22        INIT_FCALL                                               'var_dump'
         23        FETCH_DIM_R                                      ~10     !1, 2
         24        TYPE_CHECK                                   64  ~11     ~10
         25        SEND_VAL                                                 ~11
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.86 ms | 1395 KiB | 19 Q