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 instanceof IAmImmutable); var_dump($object->getName()); $object->__construct('Bob'); var_dump($object->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/naLrV
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        INSTANCEOF                                       ~3      !0, 'IAmImmutable'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                                 
   27     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'getName'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   29    13        INIT_METHOD_CALL                                         !0, '__construct'
         14        SEND_VAL_EX                                              'Bob'
         15        DO_FCALL                                      0          
   31    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'getName'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $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/naLrV
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/naLrV
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/naLrV
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:
164.53 ms | 1400 KiB | 15 Q