3v4l.org

run code in 300+ PHP versions simultaneously
<?php class friendList { private $friends; public function __construct(array $names){ $this->friends = array(); if($names) foreach($names as $name) $this->addFriend($name); } public function addFriend($name) { $this->friends[] = $name; } public function getFriends() { return $this->friends; } } $friends = new friendList(array('Eric','Dan','Lisa')); function funtimes($friends) { echo implode(", ", $friends->getFriends()) . "\n"; $friends->addFriend('John'); } funtimes($friends); var_dump($friends);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F3boT
function name:  (null)
number of ops:  11
compiled vars:  !0 = $friends
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'friendList'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   23     4        INIT_FCALL                                               'funtimes'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0          
   24     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function funtimes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F3boT
function name:  funtimes
number of ops:  13
compiled vars:  !0 = $friends
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C+'
          3        INIT_METHOD_CALL                                         !0, 'getFriends'
          4        DO_FCALL                                      0  $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      $2, '%0A'
          8        ECHO                                                     ~3
   20     9        INIT_METHOD_CALL                                         !0, 'addFriend'
         10        SEND_VAL_EX                                              'John'
         11        DO_FCALL                                      0          
   21    12      > RETURN                                                   null

End of function funtimes

Class friendList:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 11
filename:       /in/F3boT
function name:  __construct
number of ops:  12
compiled vars:  !0 = $names, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'friends'
          2        OP_DATA                                                  <array>
    7     3      > JMPZ                                                     !0, ->11
          4    > > FE_RESET_R                                       $3      !0, ->10
          5    > > FE_FETCH_R                                               $3, !1, ->10
          6    >   INIT_METHOD_CALL                                         'addFriend'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $3
    8    11    > > RETURN                                                   null

End of function __construct

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

End of function addfriend

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

End of function getfriends

End of class friendList.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.78 ms | 1403 KiB | 18 Q