3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bob = function($x, $y = 10){ return $x + $y; }; $functionReflection = new ReflectionFunction($bob); $parameters = $functionReflection->getParameters(); foreach($parameters as $param) { echo $param->name . ' '; echo intval($param->isOptional()) . ' '; echo $param->getDefaultValue; echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/jcQUb
function name:  (null)
number of ops:  25
compiled vars:  !0 = $bob, !1 = $functionReflection, !2 = $parameters, !3 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjcQUb%3A3%240'
          1        ASSIGN                                                   !0, ~4
    7     2        NEW                                              $6      'ReflectionFunction'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
    8     6        INIT_METHOD_CALL                                         !1, 'getParameters'
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !2, $9
   10     9      > FE_RESET_R                                       $11     !2, ->23
         10    > > FE_FETCH_R                                               $11, !3, ->23
   11    11    >   FETCH_OBJ_R                                      ~12     !3, 'name'
         12        CONCAT                                           ~13     ~12, '+'
         13        ECHO                                                     ~13
   12    14        INIT_METHOD_CALL                                         !3, 'isOptional'
         15        DO_FCALL                                      0  $14     
         16        CAST                                          4  ~15     $14
         17        CONCAT                                           ~16     ~15, '+'
         18        ECHO                                                     ~16
   13    19        FETCH_OBJ_R                                      ~17     !3, 'getDefaultValue'
         20        ECHO                                                     ~17
   14    21        ECHO                                                     '%0A'
   10    22      > JMP                                                      ->10
         23    >   FE_FREE                                                  $11
   15    24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjcQUb%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jcQUb
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      10
    4     2        ADD                                              ~2      !0, !1
          3      > RETURN                                                   ~2
    5     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjcQUb%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.41 ms | 1395 KiB | 13 Q