3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait DataCollector { private static function getCollectedData() { return self::collectedData( 'get' ); } private static function collectedData( $type, $value = NULL ) { static $CollectionData = array(); if( strtolower( $type ) === 'set' ) { $CollectionData[] = $value; var_dump($CollectionData); } elseif( strtolower( $type ) === 'get' ) return $CollectionData; } static function setCollectedData( $data ) { self::collectedData( 'set' , $data ); } } class dataHandler { use DataCollector { getCollectedData as public; } } dataHandler::setCollectedData( 'a' ); var_dump('collectedData' , dataHandler::getCollectedData() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4AOPn
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   DECLARE_CLASS                                            'datahandler'
   27     1        INIT_STATIC_METHOD_CALL                                  'dataHandler', 'setCollectedData'
          2        SEND_VAL_EX                                              'a'
          3        DO_FCALL                                      0          
   28     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'collectedData'
          6        INIT_STATIC_METHOD_CALL                                  'dataHandler', 'getCollectedData'
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class DataCollector:
Function getcollecteddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4AOPn
function name:  getCollectedData
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_STATIC_METHOD_CALL                                  'collectedData'
          1        SEND_VAL_EX                                              'get'
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
    5     4*     > RETURN                                                   null

End of function getcollecteddata

Function collecteddata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/4AOPn
function name:  collectedData
number of ops:  21
compiled vars:  !0 = $type, !1 = $value, !2 = $CollectionData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    8     2        BIND_STATIC                                              !2
   10     3        INIT_FCALL                                               'strtolower'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        IS_IDENTICAL                                             $3, 'set'
          7      > JMPZ                                                     ~4, ->14
   11     8    >   ASSIGN_DIM                                               !2
          9        OP_DATA                                                  !1
   12    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > JMP                                                      ->20
   14    14    >   INIT_FCALL                                               'strtolower'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17        IS_IDENTICAL                                             $7, 'get'
         18      > JMPZ                                                     ~8, ->20
   15    19    > > RETURN                                                   !2
   16    20    > > RETURN                                                   null

End of function collecteddata

Function setcollecteddata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4AOPn
function name:  setCollectedData
number of ops:  6
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_STATIC_METHOD_CALL                                  'collectedData'
          2        SEND_VAL_EX                                              'set'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   20     5      > RETURN                                                   null

End of function setcollecteddata

End of class DataCollector.

Class dataHandler: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.46 ms | 1400 KiB | 17 Q