3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait DataCollector { private $collectionData = array(); final private function setData( $data ) { $this->CollectionData[] = $data; return $this; } public function getCollectedData() { return $this->CollectionData; } } class Form {} class Field extends Form { use DataCollector; public function __construct( $type, $text = NULL ) { $this->setData( $type )->setData( $text ); } } $Field1 = new Field( 'text' ); $Field1->getCollectedData(); $Field2 = new Field( 'html', 'hello' ); $Field2->getCollectedData();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JZ2LO
function name:  (null)
number of ops:  15
compiled vars:  !0 = $Field1, !1 = $Field2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'field', 'form'
   25     1        NEW                                              $2      'Field'
          2        SEND_VAL_EX                                              'text'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   26     5        INIT_METHOD_CALL                                         !0, 'getCollectedData'
          6        DO_FCALL                                      0          
   28     7        NEW                                              $6      'Field'
          8        SEND_VAL_EX                                              'html'
          9        SEND_VAL_EX                                              'hello'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $6
   29    12        INIT_METHOD_CALL                                         !1, 'getCollectedData'
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Class DataCollector:
Function setdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JZ2LO
function name:  setData
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_OBJ_W                                      $1      'CollectionData'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
    7     4        FETCH_THIS                                       ~3      
          5      > RETURN                                                   ~3
    8     6*     > RETURN                                                   null

End of function setdata

Function getcollecteddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JZ2LO
function name:  getCollectedData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'CollectionData'
          1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function getcollecteddata

End of class DataCollector.

Class Form: [no user functions]
Class Field:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JZ2LO
function name:  __construct
number of ops:  9
compiled vars:  !0 = $type, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   21     2        INIT_METHOD_CALL                                         'setData'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        INIT_METHOD_CALL                                         $2, 'setData'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   22     8      > RETURN                                                   null

End of function __construct

End of class Field.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.09 ms | 1390 KiB | 13 Q