3v4l.org

run code in 500+ PHP versions simultaneously
<?php class User { public function __construct(public readonly string $name) {} public function say() { echo $this->name, PHP_EOL; } } class Student extends User { // } function listAll(User ...$users) { array_map( callback: fn(User $user) => $user->say(), array: $users ); } $users = [ new User('Jhon'), new User('Jane'), new Student('Bob'), // Child Student Class works. //'not User Class', // passing anything other than class User will throw TypeError. ]; listAll(...$users);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T43i6
function name:  (null)
number of ops:  18
compiled vars:  !0 = $users
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   NEW                                                  $1      'User'
          1        SEND_VAL_EX                                                  'Jhon'
          2        DO_FCALL                                          0          
          3        INIT_ARRAY                                           ~3      $1
   27     4        NEW                                                  $4      'User'
          5        SEND_VAL_EX                                                  'Jane'
          6        DO_FCALL                                          0          
          7        ADD_ARRAY_ELEMENT                                    ~3      $4
   28     8        NEW                                                  $6      'Student'
          9        SEND_VAL_EX                                                  'Bob'
         10        DO_FCALL                                          0          
         11        ADD_ARRAY_ELEMENT                                    ~3      $6
   25    12        ASSIGN                                                       !0, ~3
   32    13        INIT_FCALL                                                   'listall'
         14        SEND_UNPACK                                                  !0
         15        CHECK_UNDEF_ARGS                                             
         16        DO_FCALL                                          1          
         17      > RETURN                                                       1

Function listall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T43i6
function name:  listAll
number of ops:  7
compiled vars:  !0 = $users
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV_VARIADIC                                        !0      
   19     1        INIT_FCALL                                                   'array_map'
   20     2        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
          3        SEND_VAL                                                     ~1
   21     4        SEND_VAR                                                     !0
   19     5        DO_ICALL                                                     
   23     6      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T43i6
function name:  {closure:listAll():20}
number of ops:  5
compiled vars:  !0 = $user
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
          1        INIT_METHOD_CALL                                             !0, 'say'
          2        DO_FCALL                                          0  $1      
          3      > RETURN                                                       $1
          4*     > RETURN                                                       null

End of Dynamic Function 0

End of function listall

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

End of function __construct

Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T43i6
function name:  say
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                          ~0      'name'
          1        ECHO                                                         ~0
          2        ECHO                                                         '%0A'
   10     3      > RETURN                                                       null

End of function say

End of class User.

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

End of function __construct

Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T43i6
function name:  say
number of ops:  4
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                          ~0      'name'
          1        ECHO                                                         ~0
          2        ECHO                                                         '%0A'
   10     3      > RETURN                                                       null

End of function say

End of class Student.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.26 ms | 1350 KiB | 15 Q