3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class SomeImmutableObject { private $someString; public function __construct(string $value) { $this->someString = $value; } public function getValue(): string { return 'the value is:' . $this->someString . ' - '; } } $one = new SomeImmutableObject('Foo'); echo $one->getValue(); //Foo $one->__construct('Bar'); echo $one->getValue(); //Bar
based on CiHPG
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AWndR
function name:  (null)
number of ops:  14
compiled vars:  !0 = $one
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  18     0  E >   NEW                                              $1      :23
         1        SEND_VAL_EX                                              'Foo'
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $1
  20     4        INIT_METHOD_CALL                                         !0, 'getValue'
         5        DO_FCALL                                      0  $4      
         6        ECHO                                                     $4
  21     7        INIT_METHOD_CALL                                         !0, '__construct'
         8        SEND_VAL_EX                                              'Bar'
         9        DO_FCALL                                      0          
  22    10        INIT_METHOD_CALL                                         !0, 'getValue'
        11        DO_FCALL                                      0  $6      
        12        ECHO                                                     $6
        13      > RETURN                                                   1

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

End of function __construct

Function getvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AWndR
function name:  getValue
number of ops:  7
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  14     0  E >   FETCH_OBJ_R                                      ~0      'someString'
         1        CONCAT                                           ~1      'the+value+is%3A', ~0
         2        CONCAT                                           ~2      ~1, '+-+'
         3        VERIFY_RETURN_TYPE                                       ~2
         4      > RETURN                                                   ~2
  15     5*       VERIFY_RETURN_TYPE                                       
         6*     > RETURN                                                   null

End of function getvalue

End of class SomeImmutableObject.

Generated using Vulcan Logic Dumper, using php 7.4.0