3v4l.org

run code in 300+ PHP versions simultaneously
<?php function changeJob($person, $newjob) { $person['job'] = $newjob; // Change the person's job return $person; } function happyBirthday($person) { ++$person['age']; // Add 1 to the person's age return $person; } $person1 = array( 'name' => 'Tom', 'job' => 'Button-Pusher', 'age' => 34 ); $person2 = array( 'name' => 'John', 'job' => 'Lever-Puller', 'age' => 41 ); // Output the starting values for the people echo "<pre>Person 1: ", print_r($person1, TRUE), "</pre>"; echo "<pre>Person 2: ", print_r($person2, TRUE), "</pre>"; // Tom got a promotion and had a birthday $person1 = changeJob($person1, 'Box-Mover'); $person1 = happyBirthday($person1); // John just had a birthday $person2 = happyBirthday($person2); // Output the new values for the people 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/Zn1FT
function name:  (null)
number of ops:  44
compiled vars:  !0 = $person1, !1 = $person2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   20     1        ASSIGN                                                   !1, <array>
   27     2        ECHO                                                     '%3Cpre%3EPerson+1%3A+'
          3        INIT_FCALL                                               'print_r'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $4      
          7        ECHO                                                     $4
          8        ECHO                                                     '%3C%2Fpre%3E'
   28     9        ECHO                                                     '%3Cpre%3EPerson+2%3A+'
         10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $5      
         14        ECHO                                                     $5
         15        ECHO                                                     '%3C%2Fpre%3E'
   31    16        INIT_FCALL                                               'changejob'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 'Box-Mover'
         19        DO_FCALL                                      0  $6      
         20        ASSIGN                                                   !0, $6
   32    21        INIT_FCALL                                               'happybirthday'
         22        SEND_VAR                                                 !0
         23        DO_FCALL                                      0  $8      
         24        ASSIGN                                                   !0, $8
   35    25        INIT_FCALL                                               'happybirthday'
         26        SEND_VAR                                                 !1
         27        DO_FCALL                                      0  $10     
         28        ASSIGN                                                   !1, $10
   38    29        ECHO                                                     '%3Cpre%3EPerson+1%3A+'
         30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $12     
         34        ECHO                                                     $12
         35        ECHO                                                     '%3C%2Fpre%3E'
   39    36        ECHO                                                     '%3Cpre%3EPerson+2%3A+'
         37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !1
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $13     
         41        ECHO                                                     $13
         42        ECHO                                                     '%3C%2Fpre%3E'
         43      > RETURN                                                   1

Function changejob:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zn1FT
function name:  changeJob
number of ops:  6
compiled vars:  !0 = $person, !1 = $newjob
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN_DIM                                               !0, 'job'
          3        OP_DATA                                                  !1
    5     4      > RETURN                                                   !0
    6     5*     > 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/Zn1FT
function name:  happyBirthday
number of ops:  5
compiled vars:  !0 = $person
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        FETCH_DIM_RW                                     $1      !0, 'age'
          2        PRE_INC                                                  $1
   11     3      > RETURN                                                   !0
   12     4*     > RETURN                                                   null

End of function happybirthday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.49 ms | 1394 KiB | 18 Q