3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Singleton{ public static function getInstance($data = array()){ new static($data); } } class TestClass { use Singleton; public function __construct($params){ echo "params count is ".count($params)."<br/>"; } } $params = array( 'test' => 'value' ); TestClass::getInstance($params);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N0u35
function name:  (null)
number of ops:  6
compiled vars:  !0 = $params
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                                'testclass'
   18     1        ASSIGN                                                       !0, <array>
   23     2        INIT_STATIC_METHOD_CALL                                      'TestClass', 'getInstance'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0          
          5      > RETURN                                                       1

Class Singleton:
Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N0u35
function name:  getInstance
number of ops:  6
compiled vars:  !0 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV_INIT                                            !0      <array>
    5     1        NEW                              static              $1      
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        FREE                                                         $1
    6     5      > RETURN                                                       null

End of function getinstance

End of class Singleton.

Class TestClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N0u35
function name:  __construct
number of ops:  6
compiled vars:  !0 = $params
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   13     1        COUNT                                                ~1      !0
          2        CONCAT                                               ~2      'params+count+is+', ~1
          3        CONCAT                                               ~3      ~2, '%3Cbr%2F%3E'
          4        ECHO                                                         ~3
   14     5      > RETURN                                                       null

End of function __construct

End of class TestClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.84 ms | 2787 KiB | 13 Q