3v4l.org

run code in 300+ PHP versions simultaneously
<?php class person { var $name; // variable inside class = property function __construct($persons_name=null) { $this->name = $persons_name; } function set_name($new_name) { $this->name = $new_name; } function get_name() { // function inside class = method return $this->name; } } // Create object WITHOUT constructor by calling a method $SecurityEngineer = new person(); $SecurityEngineer->set_name("Debbie B"); echo "<br>Debbie's full name: " . $SecurityEngineer->get_name()."<br>"; // Create object WITH a constructor $WanEngineer = new person("Lisa L"); echo "Lisa's full name: " . $WanEngineer->get_name();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/15uV1
function name:  (null)
number of ops:  20
compiled vars:  !0 = $SecurityEngineer, !1 = $WanEngineer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $2      'person'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   20     3        INIT_METHOD_CALL                                         !0, 'set_name'
          4        SEND_VAL_EX                                              'Debbie+B'
          5        DO_FCALL                                      0          
   21     6        INIT_METHOD_CALL                                         !0, 'get_name'
          7        DO_FCALL                                      0  $6      
          8        CONCAT                                           ~7      '%3Cbr%3EDebbie%27s+full+name%3A+', $6
          9        CONCAT                                           ~8      ~7, '%3Cbr%3E'
         10        ECHO                                                     ~8
   24    11        NEW                                              $9      'person'
         12        SEND_VAL_EX                                              'Lisa+L'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $9
   25    15        INIT_METHOD_CALL                                         !1, 'get_name'
         16        DO_FCALL                                      0  $12     
         17        CONCAT                                           ~13     'Lisa%27s+full+name%3A+', $12
         18        ECHO                                                     ~13
         19      > RETURN                                                   1

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

End of function __construct

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

End of function set_name

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

End of function get_name

End of class person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.67 ms | 1399 KiB | 13 Q