3v4l.org

run code in 500+ PHP versions simultaneously
<?php class GlobalArrayWrapper implements ArrayAccess { protected $values = []; public function __construct(array $values) { $this->values = $values; } /** * {@inheritdoc} */ public function offsetExists($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return isset($this->values[$offset]); } /** * {@inheritdoc} */ public function offsetGet($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return $this->values[$offset] ?? NULL; } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); return $this->values[$offset] = $value; } /** * {@inheritdoc} */ public function offsetUnset($offset) { trigger_error('You are doing it wrong', E_USER_DEPRECATED); unset($this->values[$offset]); } } $GLOBALS['pager_page_array'] = [1, 2]; $GLOBALS['pager_page_array'] = new GlobalArrayWrapper($GLOBALS['pager_page_array']); echo $GLOBALS['pager_page_array'][0];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlHZK
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                                'globalarraywrapper'
   42     1        FETCH_W                          global              $0      'pager_page_array'
          2        ASSIGN                                                       $0, <array>
   43     3        NEW                                                  $3      'GlobalArrayWrapper'
          4        CHECK_FUNC_ARG                                               
          5        FETCH_FUNC_ARG                   global              $4      'pager_page_array'
          6        SEND_FUNC_ARG                                                $4
          7        DO_FCALL                                          0          
          8        FETCH_W                          global              $2      'pager_page_array'
          9        ASSIGN                                                       $2, $3
   44    10        FETCH_R                          global              ~7      'pager_page_array'
         11        FETCH_DIM_R                                          ~8      ~7, 0
         12        ECHO                                                         ~8
         13      > RETURN                                                       1

Class GlobalArrayWrapper:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlHZK
function name:  __construct
number of ops:  4
compiled vars:  !0 = $values
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        ASSIGN_OBJ                                                   'values'
          2        OP_DATA                                                      !0
    7     3      > RETURN                                                       null

End of function __construct

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlHZK
function name:  offsetExists
number of ops:  9
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
   12     1        INIT_FCALL                                                   'trigger_error'
          2        SEND_VAL                                                     'You+are+doing+it+wrong'
          3        SEND_VAL                                                     16384
          4        DO_ICALL                                                     
   13     5        FETCH_OBJ_IS                                         ~2      'values'
          6        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      ~2, !0
          7      > RETURN                                                       ~3
   14     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/AlHZK
function name:  offsetGet
number of ops:  11
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
   20     1        INIT_FCALL                                                   'trigger_error'
          2        SEND_VAL                                                     'You+are+doing+it+wrong'
          3        SEND_VAL                                                     16384
          4        DO_ICALL                                                     
   21     5        FETCH_OBJ_IS                                         ~2      'values'
          6        FETCH_DIM_IS                                         ~3      ~2, !0
          7        COALESCE                                             ~4      ~3
          8        QM_ASSIGN                                            ~4      null
          9      > RETURN                                                       ~4
   22    10*     > 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/AlHZK
function name:  offsetSet
number of ops:  11
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   28     2        INIT_FCALL                                                   'trigger_error'
          3        SEND_VAL                                                     'You+are+doing+it+wrong'
          4        SEND_VAL                                                     16384
          5        DO_ICALL                                                     
   29     6        FETCH_OBJ_W                                          $3      'values'
          7        ASSIGN_DIM                                           ~4      $3, !0
          8        OP_DATA                                                      !1
          9      > RETURN                                                       ~4
   30    10*     > RETURN                                                       null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlHZK
function name:  offsetUnset
number of ops:  8
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
   36     1        INIT_FCALL                                                   'trigger_error'
          2        SEND_VAL                                                     'You+are+doing+it+wrong'
          3        SEND_VAL                                                     16384
          4        DO_ICALL                                                     
   37     5        FETCH_OBJ_UNSET                                      $2      'values'
          6        UNSET_DIM                                                    $2, !0
   38     7      > RETURN                                                       null

End of function offsetunset

End of class GlobalArrayWrapper.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.46 ms | 2302 KiB | 14 Q