3v4l.org

run code in 300+ PHP versions simultaneously
<?php class friendList { private $friends; public function __construct(array $names=[]){ $this->friends = []; foreach($names as $name){$this->addFriend($name);} } public function addFriend($name) { $this->friends[] = $name; } public function getFriends() { return $this->friends; } } $friends = new friendList(['Eric','Dan','Lisa']); function funtimes($friends) { echo implode(", ", $friends->getFriends()); $this->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/jnGR2
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/jnGR2
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        ECHO                                                     $2
   20     8        FETCH_THIS                                       $3      
          9        INIT_METHOD_CALL                                         $3, '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 = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/jnGR2
function name:  __construct
number of ops:  11
compiled vars:  !0 = $names, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      <array>
    6     1        ASSIGN_OBJ                                               'friends'
          2        OP_DATA                                                  <array>
    7     3      > FE_RESET_R                                       $3      !0, ->9
          4    > > FE_FETCH_R                                               $3, !1, ->9
          5    >   INIT_METHOD_CALL                                         'addFriend'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $3
    8    10      > 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/jnGR2
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/jnGR2
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:
154.1 ms | 1394 KiB | 18 Q