3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($foo = 'foo', $bar) {} function str($value) { return $value === true ? 'true' : ($value === false ? 'false' : ($value === null ? 'null' : '' . $value)); } function dump_function($fn) { $rf = new ReflectionFunction($fn); $fmt = "%-10s %-5s %-5s %s\n"; vprintf($fmt, array('name', 'opt?', 'def?', 'value')); foreach ($rf->getParameters() as $param) { $p = $param; $dv = $p->isDefaultValueAvailable() ? str($p->getDefaultValue()) : '-'; printf($fmt, $param->getName(), str($p->isOptional()), str($p->isDefaultValueAvailable()), $dv); } } dump_function('foo');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qgbh7
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'dump_function'
          1        SEND_VAL                                                 'foo'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qgbh7
function name:  foo
number of ops:  3
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function foo

Function str:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qgbh7
function name:  str
number of ops:  19
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        TYPE_CHECK                                    8          !0
          2      > JMPZ                                                     ~1, ->5
          3    >   QM_ASSIGN                                        ~2      'true'
          4      > JMP                                                      ->17
          5    >   TYPE_CHECK                                    4          !0
          6      > JMPZ                                                     ~3, ->9
          7    >   QM_ASSIGN                                        ~4      'false'
          8      > JMP                                                      ->16
          9    >   TYPE_CHECK                                    2          !0
         10      > JMPZ                                                     ~5, ->13
         11    >   QM_ASSIGN                                        ~6      'null'
         12      > JMP                                                      ->15
         13    >   CONCAT                                           ~7      '', !0
         14        QM_ASSIGN                                        ~6      ~7
         15    >   QM_ASSIGN                                        ~4      ~6
         16    >   QM_ASSIGN                                        ~2      ~4
         17    > > RETURN                                                   ~2
         18*     > RETURN                                                   null

End of function str

Function dump_function:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 47
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 47
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/qgbh7
function name:  dump_function
number of ops:  49
compiled vars:  !0 = $fn, !1 = $rf, !2 = $fmt, !3 = $param, !4 = $p, !5 = $dv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        NEW                                              $6      'ReflectionFunction'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $6
    9     5        ASSIGN                                                   !2, '%25-10s+%25-5s+%25-5s+%25s%0A'
   10     6        INIT_FCALL                                               'vprintf'
          7        SEND_VAR                                                 !2
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                                 
   11    10        INIT_METHOD_CALL                                         !1, 'getParameters'
         11        DO_FCALL                                      0  $11     
         12      > FE_RESET_R                                       $12     $11, ->47
         13    > > FE_FETCH_R                                               $12, !3, ->47
   12    14    >   ASSIGN                                                   !4, !3
   13    15        INIT_METHOD_CALL                                         !4, 'isDefaultValueAvailable'
         16        DO_FCALL                                      0  $14     
         17      > JMPZ                                                     $14, ->25
         18    >   INIT_FCALL                                               'str'
         19        INIT_METHOD_CALL                                         !4, 'getDefaultValue'
         20        DO_FCALL                                      0  $15     
         21        SEND_VAR                                                 $15
         22        DO_FCALL                                      0  $16     
         23        QM_ASSIGN                                        ~17     $16
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~17     '-'
         26    >   ASSIGN                                                   !5, ~17
   14    27        INIT_FCALL                                               'printf'
         28        SEND_VAR                                                 !2
         29        INIT_METHOD_CALL                                         !3, 'getName'
         30        DO_FCALL                                      0  $19     
         31        SEND_VAR                                                 $19
         32        INIT_FCALL                                               'str'
         33        INIT_METHOD_CALL                                         !4, 'isOptional'
         34        DO_FCALL                                      0  $20     
         35        SEND_VAR                                                 $20
         36        DO_FCALL                                      0  $21     
         37        SEND_VAR                                                 $21
         38        INIT_FCALL                                               'str'
         39        INIT_METHOD_CALL                                         !4, 'isDefaultValueAvailable'
         40        DO_FCALL                                      0  $22     
         41        SEND_VAR                                                 $22
         42        DO_FCALL                                      0  $23     
         43        SEND_VAR                                                 $23
         44        SEND_VAR                                                 !5
         45        DO_ICALL                                                 
   11    46      > JMP                                                      ->13
         47    >   FE_FREE                                                  $12
   16    48      > RETURN                                                   null

End of function dump_function

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.27 ms | 1014 KiB | 19 Q