3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ new Person('thomas', 'gutbier'), new Person('mathhias', 'gutbier'), new Person('ursula', 'breidenstein'), new Person('salbert', 'friemel') ]; foreach ($a as $person) { echo $person; } class Person { public $name; public $vorname; public function __construct ($name, $vorname) { $this->name = $name; $this->vorname = $vorname; } public function renderPerson () { return $this->vorname . ' ' . $this->name . "\n"; } public function __toString() { return $this->renderPerson(); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/fOQ8R
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $person
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'Person'
          1        SEND_VAL_EX                                              'thomas'
          2        SEND_VAL_EX                                              'gutbier'
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~4      $2
    4     5        NEW                                              $5      'Person'
          6        SEND_VAL_EX                                              'mathhias'
          7        SEND_VAL_EX                                              'gutbier'
          8        DO_FCALL                                      0          
          9        ADD_ARRAY_ELEMENT                                ~4      $5
    5    10        NEW                                              $7      'Person'
         11        SEND_VAL_EX                                              'ursula'
         12        SEND_VAL_EX                                              'breidenstein'
         13        DO_FCALL                                      0          
         14        ADD_ARRAY_ELEMENT                                ~4      $7
    6    15        NEW                                              $9      'Person'
         16        SEND_VAL_EX                                              'salbert'
         17        SEND_VAL_EX                                              'friemel'
         18        DO_FCALL                                      0          
         19        ADD_ARRAY_ELEMENT                                ~4      $9
    2    20        ASSIGN                                                   !0, ~4
    8    21      > FE_RESET_R                                       $12     !0, ->25
         22    > > FE_FETCH_R                                               $12, !1, ->25
    9    23    >   ECHO                                                     !1
    8    24      > JMP                                                      ->22
         25    >   FE_FREE                                                  $12
   11    26        DECLARE_CLASS                                            'person'
   30    27      > RETURN                                                   1

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

End of function __construct

Function renderperson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fOQ8R
function name:  renderPerson
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      'vorname'
          1        CONCAT                                           ~1      ~0, '+'
          2        FETCH_OBJ_R                                      ~2      'name'
          3        CONCAT                                           ~3      ~1, ~2
          4        CONCAT                                           ~4      ~3, '%0A'
          5      > RETURN                                                   ~4
   24     6*     > RETURN                                                   null

End of function renderperson

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fOQ8R
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_METHOD_CALL                                         'renderPerson'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   29     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

End of class Person.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.9 ms | 1390 KiB | 13 Q