3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait DataCollector { public static $CollectionData; public static function setData( $data ) { if (!isset(self::$CollectionData)) self::$CollectionData = array(); self::$CollectionData[] = $data; } private static function getCollectedData() { return self::$CollectionData; } } trait dataHandler { use DataCollector { getCollectedData as public; } } class Form { use DataCollector {} } class Field extends Form { public function __construct( $type, $text = NULL ) { self::setData( $type ); } } $Field1 = new Field( 'text' ); $Field2 = new Field( 'html' ); var_dump( 'Collected Data', dataHandler::getCollectedData() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m0v82
function name:  (null)
number of ops:  18
compiled vars:  !0 = $Field1, !1 = $Field2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_CLASS                                            'datahandler'
   18     1        DECLARE_CLASS                                            'form'
   20     2        DECLARE_CLASS                                            'field', 'form'
   26     3        NEW                                              $2      'Field'
          4        SEND_VAL_EX                                              'text'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   27     7        NEW                                              $5      'Field'
          8        SEND_VAL_EX                                              'html'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   29    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAL                                                 'Collected+Data'
         13        INIT_STATIC_METHOD_CALL                                  'dataHandler', 'getCollectedData'
         14        DO_FCALL                                      0  $8      
         15        SEND_VAR                                                 $8
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class DataCollector:
Function setdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/m0v82
function name:  setData
number of ops:  10
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ISSET_ISEMPTY_STATIC_PROP                        ~1      'CollectionData'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
    7     4    >   ASSIGN_STATIC_PROP                                       'CollectionData'
          5        OP_DATA                                                  <array>
    8     6    >   FETCH_STATIC_PROP_W          unknown             $4      'CollectionData'
          7        ASSIGN_DIM                                               $4
          8        OP_DATA                                                  !0
    9     9      > 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/m0v82
function name:  getCollectedData
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'CollectionData'
          1      > RETURN                                                   ~0
   13     2*     > RETURN                                                   null

End of function getcollecteddata

End of class DataCollector.

Class dataHandler: [no user functions]
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/m0v82
function name:  __construct
number of ops:  6
compiled vars:  !0 = $type, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   22     2        INIT_STATIC_METHOD_CALL                                  'setData'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   23     5      > RETURN                                                   null

End of function __construct

End of class Field.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.77 ms | 1392 KiB | 15 Q