3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IAmImmutable { private $name; public static function createFromName($name) { return new self($name); } private function __construct($name) { $this->name = $name; } public function getName() { return $this->name; } } $object = IAmImmutable::createFromName('Peter'); var_dump($object->getName()); $object->__construct('Bob'); var_dump($object->getName()); var_dump($object instanceof IAmImmutable);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RAURr
function name:  (null)
number of ops:  22
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'IAmImmutable', 'createFromName'
          1        SEND_VAL                                                 'Peter'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   25     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getName'
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
   27     9        INIT_METHOD_CALL                                         !0, '__construct'
         10        SEND_VAL_EX                                              'Bob'
         11        DO_FCALL                                      0          
   29    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'getName'
         14        DO_FCALL                                      0  $6      
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                                 
   31    17        INIT_FCALL                                               'var_dump'
         18        INSTANCEOF                                       ~8      !0, 'IAmImmutable'
         19        SEND_VAL                                                 ~8
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class IAmImmutable:
Function createfromname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RAURr
function name:  createFromName
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        NEW                          self                $1      
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $1
   10     5*     > RETURN                                                   null

End of function createfromname

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

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RAURr
function name:  getName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   20     2*     > RETURN                                                   null

End of function getname

End of class IAmImmutable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.21 ms | 1400 KiB | 15 Q