3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a=1; public $b=2; public $c=3; } class B { public $a=5; public $b=6; public $e=7; public $f=8; } $foo = new A; $bar = new B; foreach(get_object_vars($foo) as $name=>$value) { if(property_exists($bar, $name)) { $bar->$name = $value; } } var_dump($bar);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/UluQF
function name:  (null)
number of ops:  25
compiled vars:  !0 = $foo, !1 = $bar, !2 = $value, !3 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $4      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   19     3        NEW                                              $7      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
   21     6        INIT_FCALL                                               'get_object_vars'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $10     
          9      > FE_RESET_R                                       $11     $10, ->20
         10    > > FE_FETCH_R                                       ~12     $11, !2, ->20
         11    >   ASSIGN                                                   !3, ~12
   23    12        INIT_FCALL                                               'property_exists'
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $14     
         16      > JMPZ                                                     $14, ->19
   25    17    >   ASSIGN_OBJ                                               !1, !3
         18        OP_DATA                                                  !2
   21    19    > > JMP                                                      ->10
         20    >   FE_FREE                                                  $11
   29    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.88 ms | 1395 KiB | 19 Q