3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getData($name, $limit = "50", $page = "1") { foreach((new ReflectionFunction(debug_backtrace()[0]["function"]))->getParameters() as $param) { if(empty(${$param->getName()}) && $param->isOptional()) ${$param->getName()} = $param->getDefaultValue(); } echo $name . PHP_EOL; echo $limit . PHP_EOL; echo $page . PHP_EOL; } //with empty parameters getData("some name", "", "23"); echo str_repeat(PHP_EOL, 3); //without empty paramters getData("some name", "23", "23");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjkVj
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'getdata'
          1        SEND_VAL                                                 'some+name'
          2        SEND_VAL                                                 ''
          3        SEND_VAL                                                 '23'
          4        DO_FCALL                                      0          
   17     5        INIT_FCALL                                               'str_repeat'
          6        SEND_VAL                                                 '%0A'
          7        SEND_VAL                                                 3
          8        DO_ICALL                                         $1      
          9        ECHO                                                     $1
   20    10        INIT_FCALL                                               'getdata'
         11        SEND_VAL                                                 'some+name'
         12        SEND_VAL                                                 '23'
         13        SEND_VAL                                                 '23'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function getdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
Branch analysis from position: 23
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/cjkVj
function name:  getData
number of ops:  39
compiled vars:  !0 = $name, !1 = $limit, !2 = $page, !3 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      '50'
          2        RECV_INIT                                        !2      '1'
    4     3        NEW                                              $4      'ReflectionFunction'
          4        CHECK_FUNC_ARG                                           
          5        INIT_FCALL                                               'debug_backtrace'
          6        DO_ICALL                                         $5      
          7        SEPARATE                                         $5      $5
          8        FETCH_DIM_FUNC_ARG                               $6      $5, 0
          9        FETCH_DIM_FUNC_ARG                               $7      $6, 'function'
         10        SEND_FUNC_ARG                                            $7
         11        DO_FCALL                                      0          
         12        INIT_METHOD_CALL                                         $4, 'getParameters'
         13        DO_FCALL                                      0  $9      
         14      > FE_RESET_R                                       $10     $9, ->31
         15    > > FE_FETCH_R                                               $10, !3, ->31
    5    16    >   INIT_METHOD_CALL                                         !3, 'getName'
         17        DO_FCALL                                      0  $11     
         18        ISSET_ISEMPTY_VAR                             5  ~12     $11
         19      > JMPZ_EX                                          ~12     ~12, ->23
         20    >   INIT_METHOD_CALL                                         !3, 'isOptional'
         21        DO_FCALL                                      0  $13     
         22        BOOL                                             ~12     $13
         23    > > JMPZ                                                     ~12, ->30
    6    24    >   INIT_METHOD_CALL                                         !3, 'getName'
         25        DO_FCALL                                      0  $14     
         26        INIT_METHOD_CALL                                         !3, 'getDefaultValue'
         27        DO_FCALL                                      0  $16     
         28        FETCH_W                      local               $15     $14
         29        ASSIGN                                                   $15, $16
    4    30    > > JMP                                                      ->15
         31    >   FE_FREE                                                  $10
    9    32        CONCAT                                           ~18     !0, '%0A'
         33        ECHO                                                     ~18
   10    34        CONCAT                                           ~19     !1, '%0A'
         35        ECHO                                                     ~19
   11    36        CONCAT                                           ~20     !2, '%0A'
         37        ECHO                                                     ~20
   12    38      > RETURN                                                   null

End of function getdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.02 ms | 1394 KiB | 19 Q