3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait GenericList { public function __call($func, $argv) { echo "__call called \n"; if (!is_callable($func) || substr($func, 0, 6) !== 'array_') { throw new \BadMethodCallException(__CLASS__.'->'.$func); } return call_user_func_array($func, array_merge(array($this->getArrayCopy()), $argv)); } final public function offsetUnset($offset) { parent::offsetUnset($offset); } final public function sort($preserveKeys = false) { if($preserveKeys) parent::ksort(); else parent::exchangeArray (\Arr::reindex(parent::getArrayCopy ())); } final public function clear(){ parent::exchangeArray([]); } } final class LineItemList extends \ArrayObject { use GenericList; public function offsetSet($offset, $value) { if (!($value instanceof LineItemBase)) { throw new \InvalidArgumentException("Value has to be a instance of LineItemBase"); } parent::offsetSet($offset, $value); } } class LineItemBase{ public $blah; public function __construct(string $blah){ $this->blah = $blah; } } $list = new LineItemList(); $list []= new LineItemBase('SDSdSD'); echo $list [0]->blah;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FPKJP
function name:  (null)
number of ops:  13
compiled vars:  !0 = $list
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   DECLARE_CLASS                                                'lineitemlist', 'arrayobject'
   51     1        NEW                                                  $1      'LineItemList'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   52     4        NEW                                                  $5      'LineItemBase'
          5        SEND_VAL_EX                                                  'SDSdSD'
          6        DO_FCALL                                          0          
          7        ASSIGN_DIM                                                   !0
          8        OP_DATA                                                      $5
   53     9        FETCH_DIM_R                                          ~7      !0, 0
         10        FETCH_OBJ_R                                          ~8      ~7, 'blah'
         11        ECHO                                                         ~8
   54    12      > RETURN                                                       1

Class GenericList:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/FPKJP
function name:  __call
number of ops:  33
compiled vars:  !0 = $func, !1 = $argv
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    7     2        ECHO                                                         '__call+called+%0A'
    8     3        INIT_FCALL                                                   'is_callable'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $2      
          6        BOOL_NOT                                             ~3      $2
          7      > JMPNZ_EX                                             ~3      ~3, ->12
          8    >   FRAMELESS_ICALL_3                substr              ~4      !0, 0
          9        OP_DATA                                                      6
         10        IS_NOT_IDENTICAL                                     ~5      ~4, 'array_'
         11        BOOL                                                 ~3      ~5
         12    > > JMPZ                                                         ~3, ->20
   10    13    >   NEW                                                  $6      'BadMethodCallException'
         14        FETCH_CLASS_NAME                                     ~7      
         15        CONCAT                                               ~8      ~7, '-%3E'
         16        CONCAT                                               ~9      ~8, !0
         17        SEND_VAL_EX                                                  ~9
         18        DO_FCALL                                          0          
         19      > THROW                                             0          $6
   12    20    >   INIT_USER_CALL                                    0          'call_user_func_array', !0
         21        INIT_FCALL                                                   'array_merge'
         22        INIT_METHOD_CALL                                             'getArrayCopy'
         23        DO_FCALL                                          0  $11     
         24        INIT_ARRAY                                           ~12     $11
         25        SEND_VAL                                                     ~12
         26        SEND_VAR                                                     !1
         27        DO_ICALL                                             $13     
         28        SEND_ARRAY                                                   $13
         29        CHECK_UNDEF_ARGS                                             
         30        DO_FCALL                                          1  $14     
         31      > RETURN                                                       $14
   13    32*     > RETURN                                                       null

End of function __call

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FPKJP
function name:  offsetUnset
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
   16     1        INIT_STATIC_METHOD_CALL                                      'offsetUnset'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
   17     4      > RETURN                                                       null

End of function offsetunset

Function sort:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FPKJP
function name:  sort
number of ops:  14
compiled vars:  !0 = $preserveKeys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV_INIT                                            !0      <false>
   20     1      > JMPZ                                                         !0, ->5
   21     2    >   INIT_STATIC_METHOD_CALL                                      'ksort'
          3        DO_FCALL                                          0          
   20     4      > JMP                                                          ->13
   23     5    >   INIT_STATIC_METHOD_CALL                                      'exchangeArray'
          6        INIT_STATIC_METHOD_CALL                                      'Arr', 'reindex'
          7        INIT_STATIC_METHOD_CALL                                      'getArrayCopy'
          8        DO_FCALL                                          0  $2      
          9        SEND_VAR_NO_REF_EX                                           $2
         10        DO_FCALL                                          0  $3      
         11        SEND_VAR_NO_REF_EX                                           $3
         12        DO_FCALL                                          0          
   24    13    > > RETURN                                                       null

End of function sort

Function clear:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FPKJP
function name:  clear
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                      'exchangeArray'
          1        SEND_VAL_EX                                                  <array>
          2        DO_FCALL                                          0          
   28     3      > RETURN                                                       null

End of function clear

End of class GenericList.

Class LineItemList:
Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FPKJP
function name:  offsetSet
number of ops:  14
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   36     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   37     2        INSTANCEOF                                           ~2      !1, 'LineItemBase'
          3        BOOL_NOT                                             ~3      ~2
          4      > JMPZ                                                         ~3, ->9
   38     5    >   NEW                                                  $4      'InvalidArgumentException'
          6        SEND_VAL_EX                                                  'Value+has+to+be+a+instance+of+LineItemBase'
          7        DO_FCALL                                          0          
          8      > THROW                                             0          $4
   40     9    >   INIT_STATIC_METHOD_CALL                                      'offsetSet'
         10        SEND_VAR_EX                                                  !0
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
   41    13      > RETURN                                                       null

End of function offsetset

End of class LineItemList.

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

End of function __construct

End of class LineItemBase.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.43 ms | 2651 KiB | 17 Q