3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Msg { var $x = array(); function __construct() { echo "CONSTRUCTOR CALLED\r\n"; } function testStaticSet() { Msg::setValue("ERROR", 'HELLO!'); } function setValue($name, $value) { if(!isset($this)) { echo "called static outside of class!\n"; return false; } $this->x[$name] = $value; } function getValue($name) { if(!isset($this)) { echo "called static outside of class!\n"; return false; } return $this->x[$name]; } } Msg::setValue("ERROR", 'Hello World!'); echo Msg::getValue("ERROR"); $a = new Msg(); $a->testStaticSet(); echo $a->getValue("ERROR");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YsJdX
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_STATIC_METHOD_CALL                                  'Msg', 'setValue'
          1        SEND_VAL                                                 'ERROR'
          2        SEND_VAL                                                 'Hello+World%21'
          3        DO_FCALL                                      0          
   31     4        INIT_STATIC_METHOD_CALL                                  'Msg', 'getValue'
          5        SEND_VAL                                                 'ERROR'
          6        DO_FCALL                                      0  $2      
          7        ECHO                                                     $2
   32     8        NEW                                              $3      'Msg'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $3
   33    11        INIT_METHOD_CALL                                         !0, 'testStaticSet'
         12        DO_FCALL                                      0          
   34    13        INIT_METHOD_CALL                                         !0, 'getValue'
         14        SEND_VAL_EX                                              'ERROR'
         15        DO_FCALL                                      0  $7      
         16        ECHO                                                     $7
         17      > RETURN                                                   1

Class Msg:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YsJdX
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'CONSTRUCTOR+CALLED%0D%0A'
    7     1      > RETURN                                                   null

End of function __construct

Function teststaticset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YsJdX
function name:  testStaticSet
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'Msg', 'setValue'
          1        SEND_VAL_EX                                              'ERROR'
          2        SEND_VAL_EX                                              'HELLO%21'
          3        DO_FCALL                                      0          
   11     4      > RETURN                                                   null

End of function teststaticset

Function setvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YsJdX
function name:  setValue
number of ops:  11
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        ISSET_ISEMPTY_THIS                               ~2      
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->7
   15     5    >   ECHO                                                     'called+static+outside+of+class%21%0A'
   16     6      > RETURN                                                   <false>
   18     7    >   FETCH_OBJ_W                                      $4      'x'
          8        ASSIGN_DIM                                               $4, !0
          9        OP_DATA                                                  !1
   19    10      > RETURN                                                   null

End of function setvalue

Function getvalue:
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YsJdX
function name:  getValue
number of ops:  10
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ISSET_ISEMPTY_THIS                               ~1      
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
   23     4    >   ECHO                                                     'called+static+outside+of+class%21%0A'
   24     5      > RETURN                                                   <false>
   26     6    >   FETCH_OBJ_R                                      ~3      'x'
          7        FETCH_DIM_R                                      ~4      ~3, !0
          8      > RETURN                                                   ~4
   27     9*     > RETURN                                                   null

End of function getvalue

End of class Msg.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.75 ms | 1399 KiB | 13 Q