3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Example { private $variable; public function __construct($variable) { $this->variable = fopen('php://memory', 'rw+'); fwrite($this->variable, $variable); } public function example() { return file_get_contents($this->variable); } public function setExample($variable) { fwrite($this->variable, $variable); } public function __destruct() { fclose($this->variable); } } $example = new Example('first'); print $example->example() . PHP_EOL; $example->setExample('second'); print $example->example() . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sn6ed
function name:  (null)
number of ops:  16
compiled vars:  !0 = $example
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'Example'
          1        SEND_VAL_EX                                              'first'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   31     4        INIT_METHOD_CALL                                         !0, 'example'
          5        DO_FCALL                                      0  $4      
          6        CONCAT                                           ~5      $4, '%0A'
          7        ECHO                                                     ~5
   32     8        INIT_METHOD_CALL                                         !0, 'setExample'
          9        SEND_VAL_EX                                              'second'
         10        DO_FCALL                                      0          
   33    11        INIT_METHOD_CALL                                         !0, 'example'
         12        DO_FCALL                                      0  $7      
         13        CONCAT                                           ~8      $7, '%0A'
         14        ECHO                                                     ~8
         15      > RETURN                                                   1

Class Example:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sn6ed
function name:  __construct
number of ops:  13
compiled vars:  !0 = $variable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          3        SEND_VAL                                                 'rw%2B'
          4        DO_ICALL                                         $2      
          5        ASSIGN_OBJ                                               'variable'
          6        OP_DATA                                                  $2
   10     7        INIT_FCALL                                               'fwrite'
          8        FETCH_OBJ_R                                      ~3      'variable'
          9        SEND_VAL                                                 ~3
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   11    12      > RETURN                                                   null

End of function __construct

Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sn6ed
function name:  example
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'file_get_contents'
          1        FETCH_OBJ_R                                      ~0      'variable'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   16     5*     > RETURN                                                   null

End of function example

Function setexample:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sn6ed
function name:  setExample
number of ops:  7
compiled vars:  !0 = $variable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'fwrite'
          2        FETCH_OBJ_R                                      ~1      'variable'
          3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   21     6      > RETURN                                                   null

End of function setexample

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sn6ed
function name:  __destruct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'fclose'
          1        FETCH_OBJ_R                                      ~0      'variable'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   26     4      > RETURN                                                   null

End of function __destruct

End of class Example.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.42 ms | 1400 KiB | 21 Q