3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CaseInsensitiveArray extends ArrayObject { public function offsetExists($index) { return parent::offsetExists(strtolower($index)); } public function offsetGet($index) { return parent::offsetGet(strtolower($index)); } public function offsetSet($index, $newval) { parent::offsetSet(strtolower($index), $newval); } } $test = new CaseInsensitiveArray; $test['Location'] = 'test'; ini_set('error_reporting', E_ALL); var_dump($test['location']); var_dump($test['Location']); var_dump(isset($test['location'])); var_dump(isset($test['Location']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i0rbp
function name:  (null)
number of ops:  26
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'CaseInsensitiveArray'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        ASSIGN_DIM                                               !0, 'Location'
          4        OP_DATA                                                  'test'
   25     5        INIT_FCALL                                               'ini_set'
          6        SEND_VAL                                                 'error_reporting'
          7        SEND_VAL                                                 32767
          8        DO_ICALL                                                 
   26     9        INIT_FCALL                                               'var_dump'
         10        FETCH_DIM_R                                      ~6      !0, 'location'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
   27    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~8      !0, 'Location'
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                                 
   28    17        INIT_FCALL                                               'var_dump'
         18        ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !0, 'location'
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                                 
   29    21        INIT_FCALL                                               'var_dump'
         22        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !0, 'Location'
         23        SEND_VAL                                                 ~12
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class CaseInsensitiveArray:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i0rbp
function name:  offsetExists
number of ops:  9
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_STATIC_METHOD_CALL                                  'offsetExists'
          2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        SEND_VAR_NO_REF_EX                                       $1
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
   10     8*     > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i0rbp
function name:  offsetGet
number of ops:  9
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_STATIC_METHOD_CALL                                  'offsetGet'
          2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        SEND_VAR_NO_REF_EX                                       $1
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
   15     8*     > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i0rbp
function name:  offsetSet
number of ops:  10
compiled vars:  !0 = $index, !1 = $newval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        INIT_STATIC_METHOD_CALL                                  'offsetSet'
          3        INIT_FCALL                                               'strtolower'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR_NO_REF_EX                                       $2
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   20     9      > RETURN                                                   null

End of function offsetset

End of class CaseInsensitiveArray.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.46 ms | 1405 KiB | 19 Q