3v4l.org

run code in 300+ 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; $list->array_search('adf');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/foEJX
function name:  (null)
number of ops:  16
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        INIT_METHOD_CALL                                         !0, 'array_search'
         13        SEND_VAL_EX                                              'adf'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Class GenericList:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/foEJX
function name:  __call
number of ops:  36
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, ->15
          8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 6
         12        DO_ICALL                                         $4      
         13        IS_NOT_IDENTICAL                                 ~5      $4, 'array_'
         14        BOOL                                             ~3      ~5
         15    > > JMPZ                                                     ~3, ->23
   10    16    >   NEW                                              $6      'BadMethodCallException'
         17        FETCH_CLASS_NAME                                 ~7      
         18        CONCAT                                           ~8      ~7, '-%3E'
         19        CONCAT                                           ~9      ~8, !0
         20        SEND_VAL_EX                                              ~9
         21        DO_FCALL                                      0          
         22      > THROW                                         0          $6
   12    23    >   INIT_USER_CALL                                0          'call_user_func_array', !0
         24        INIT_FCALL                                               'array_merge'
         25        INIT_METHOD_CALL                                         'getArrayCopy'
         26        DO_FCALL                                      0  $11     
         27        INIT_ARRAY                                       ~12     $11
         28        SEND_VAL                                                 ~12
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $13     
         31        SEND_ARRAY                                               $13
         32        CHECK_UNDEF_ARGS                                         
         33        DO_FCALL                                      0  $14     
         34      > RETURN                                                   $14
   13    35*     > 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/foEJX
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/foEJX
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          
          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/foEJX
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/foEJX
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/foEJX
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.0.0


preferences:
178.42 ms | 1404 KiB | 19 Q