3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'bar'; private $baz = 'value of baz'; function getBaz() { return $this->baz; } function setBaz($val) { $this->baz = $val; } function issetBaz(){ return isset($this->baz); } function unBaz(){ unset($this->baz); echo 'Bye bye baz',"\n"; } } $foo = new Foo; echo $foo->getBaz(), "\n"; $foo->setBaz(null); echo $foo->issetBaz()? 'is set': 'is unset', "\n"; var_dump($foo); $foo->unBaz(); var_dump($foo); $foo->setBaz('baz again!'); echo $foo->baz, "\n"; //echo $foo->getBaz(), "\n"; var_dump($foo);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iX48P
function name:  (null)
number of ops:  36
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'getBaz'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6        ECHO                                                     '%0A'
   24     7        INIT_METHOD_CALL                                         !0, 'setBaz'
          8        SEND_VAL_EX                                              null
          9        DO_FCALL                                      0          
   25    10        INIT_METHOD_CALL                                         !0, 'issetBaz'
         11        DO_FCALL                                      0  $6      
         12      > JMPZ                                                     $6, ->15
         13    >   QM_ASSIGN                                        ~7      'is+set'
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~7      'is+unset'
         16    >   ECHO                                                     ~7
         17        ECHO                                                     '%0A'
   26    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   27    21        INIT_METHOD_CALL                                         !0, 'unBaz'
         22        DO_FCALL                                      0          
   28    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   29    26        INIT_METHOD_CALL                                         !0, 'setBaz'
         27        SEND_VAL_EX                                              'baz+again%21'
         28        DO_FCALL                                      0          
   30    29        FETCH_OBJ_R                                      ~12     !0, 'baz'
         30        ECHO                                                     ~12
         31        ECHO                                                     '%0A'
   32    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Class Foo:
Function getbaz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iX48P
function name:  getBaz
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'baz'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function getbaz

Function setbaz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iX48P
function name:  setBaz
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'baz'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function setbaz

Function issetbaz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iX48P
function name:  issetBaz
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'baz'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function issetbaz

Function unbaz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iX48P
function name:  unBaz
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   UNSET_OBJ                                                'baz'
   18     1        ECHO                                                     'Bye+bye+baz'
          2        ECHO                                                     '%0A'
   19     3      > RETURN                                                   null

End of function unbaz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.13 ms | 1392 KiB | 15 Q