3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { private $_name; private $_job; private $_age; public function __construct($name, $job, $age) { $this->_name = $name; $this->_job = $job; $this->_age = $age; } public function changeJob($newjob) { $this->_job = $newjob; } public function happyBirthday() { ++$this->_age; } } // Create two new people $person1 = new Person("Tom", "Button-Pusher", 34); $person2 = new Person("John", "Lever Puller", 41); // Output their starting point echo "<pre>Person 1: ", print_r($person1, TRUE), "</pre>"; echo "<pre>Person 2: ", print_r($person2, TRUE), "</pre>"; // Give Tom a promotion and a birthday $person1->changeJob("Box-Mover"); $person1->happyBirthday(); // John just gets a year older $person2->happyBirthday(); // Output the ending values echo "<pre>Person 1: ", print_r($person1, TRUE), "</pre>"; echo "<pre>Person 2: ", print_r($person2, TRUE), "</pre>"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9raZ
function name:  (null)
number of ops:  48
compiled vars:  !0 = $person1, !1 = $person2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $2      'Person'
          1        SEND_VAL_EX                                              'Tom'
          2        SEND_VAL_EX                                              'Button-Pusher'
          3        SEND_VAL_EX                                              34
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   29     6        NEW                                              $5      'Person'
          7        SEND_VAL_EX                                              'John'
          8        SEND_VAL_EX                                              'Lever+Puller'
          9        SEND_VAL_EX                                              41
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $5
   32    12        ECHO                                                     '%3Cpre%3EPerson+1%3A+'
         13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $8      
         17        ECHO                                                     $8
         18        ECHO                                                     '%3C%2Fpre%3E'
   33    19        ECHO                                                     '%3Cpre%3EPerson+2%3A+'
         20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !1
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $9      
         24        ECHO                                                     $9
         25        ECHO                                                     '%3C%2Fpre%3E'
   36    26        INIT_METHOD_CALL                                         !0, 'changeJob'
         27        SEND_VAL_EX                                              'Box-Mover'
         28        DO_FCALL                                      0          
   37    29        INIT_METHOD_CALL                                         !0, 'happyBirthday'
         30        DO_FCALL                                      0          
   40    31        INIT_METHOD_CALL                                         !1, 'happyBirthday'
         32        DO_FCALL                                      0          
   43    33        ECHO                                                     '%3Cpre%3EPerson+1%3A+'
         34        INIT_FCALL                                               'print_r'
         35        SEND_VAR                                                 !0
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $13     
         38        ECHO                                                     $13
         39        ECHO                                                     '%3C%2Fpre%3E'
   44    40        ECHO                                                     '%3Cpre%3EPerson+2%3A+'
         41        INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !1
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $14     
         45        ECHO                                                     $14
         46        ECHO                                                     '%3C%2Fpre%3E'
   46    47      > RETURN                                                   1

Class Person:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9raZ
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $job, !2 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   11     3        ASSIGN_OBJ                                               '_name'
          4        OP_DATA                                                  !0
   12     5        ASSIGN_OBJ                                               '_job'
          6        OP_DATA                                                  !1
   13     7        ASSIGN_OBJ                                               '_age'
          8        OP_DATA                                                  !2
   14     9      > RETURN                                                   null

End of function __construct

Function changejob:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9raZ
function name:  changeJob
number of ops:  4
compiled vars:  !0 = $newjob
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        ASSIGN_OBJ                                               '_job'
          2        OP_DATA                                                  !0
   19     3      > RETURN                                                   null

End of function changejob

Function happybirthday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9raZ
function name:  happyBirthday
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   PRE_INC_OBJ                                              '_age'
   24     1      > RETURN                                                   null

End of function happybirthday

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
222.06 ms | 1404 KiB | 15 Q