3v4l.org

run code in 300+ PHP versions simultaneously
<?php // PHP 8.1 class Exemplo { public readonly string $text; public function __construct(string $text) { // aqui podemos alterar $this->text = $text; } public function setText(string $newText): void { // aqui não podemos $this->text = $newText; } } $exemplo = new Exemplo("Ola mundo"); var_dump($exemplo->text); // string(Ola mundo) // descomente para ver o erro // $exemplo->setText("Adeus mundo"); // aqui também não podemos // descomente para ver o erro // $exemplo->text = "Adeus mundo";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U0K7c
function name:  (null)
number of ops:  9
compiled vars:  !0 = $exemplo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Exemplo'
          1        SEND_VAL_EX                                              'Ola+mundo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_FCALL                                               'var_dump'
          5        FETCH_OBJ_R                                      ~4      !0, 'text'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   28     8      > RETURN                                                   1

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

End of function __construct

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

End of function settext

End of class Exemplo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.97 ms | 1005 KiB | 14 Q