3v4l.org

run code in 300+ PHP versions simultaneously
<?php $closure1 = function(integer $param1) { return $param1 * 2; }; $closure2 = function(string $param1) { return mb_strlen($param1); }; foreach (['preg_replace', $closure1, $closure2] as &$func) { $reflection = new ReflectionFunction($func); if (version_compare(PHP_VERSION, '7.0.0') >= 0) { echo $reflection->getReturnType()." "; } echo $reflection->getName()." ["; foreach($reflection->getParameters() as &$param) { // PHP 7.0+ required for get type if (version_compare(PHP_VERSION, '7.0.0') >= 0) { if ($param->hasType()) { echo $param->getType().($param->allowsNull() ? '|null' : '')." "; } } echo ($param->isOptional() ? '[' : '').$param->getName().($param->isOptional() ? ']' : ''); echo "; "; } echo "]"; echo "\n\n\n"; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 75
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 75
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 125) Position 1 = 31, Position 2 = 71
Branch analysis from position: 31
2 jumps found. (Code = 126) Position 1 = 32, Position 2 = 71
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 52
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 52
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 57
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 66
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 66
Branch analysis from position: 64
Branch analysis from position: 66
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 57
Branch analysis from position: 55
Branch analysis from position: 57
Branch analysis from position: 52
Branch analysis from position: 52
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 71
Branch analysis from position: 23
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
filename:       /in/uufKo
function name:  (null)
number of ops:  77
compiled vars:  !0 = $closure1, !1 = $closure2, !2 = $func, !3 = $reflection, !4 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuufKo%3A2%240'
          1        ASSIGN                                                   !0, ~5
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuufKo%3A6%241'
          3        ASSIGN                                                   !1, ~7
   10     4        INIT_ARRAY                                       ~9      'preg_replace'
          5        ADD_ARRAY_ELEMENT                                ~9      !0
          6        ADD_ARRAY_ELEMENT                                ~9      !1
          7      > FE_RESET_RW                                      $10     ~9, ->75
          8    > > FE_FETCH_RW                                              $10, !2, ->75
   11     9    >   NEW                                              $11     'ReflectionFunction'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !3, $11
   12    13        INIT_FCALL                                               'version_compare'
         14        SEND_VAL                                                 '8.0.0'
         15        SEND_VAL                                                 '7.0.0'
         16        DO_ICALL                                         $14     
         17        IS_SMALLER_OR_EQUAL                                      0, $14
         18      > JMPZ                                                     ~15, ->23
   13    19    >   INIT_METHOD_CALL                                         !3, 'getReturnType'
         20        DO_FCALL                                      0  $16     
         21        CONCAT                                           ~17     $16, '+'
         22        ECHO                                                     ~17
   15    23    >   INIT_METHOD_CALL                                         !3, 'getName'
         24        DO_FCALL                                      0  $18     
         25        CONCAT                                           ~19     $18, '+%5B'
         26        ECHO                                                     ~19
   16    27        INIT_METHOD_CALL                                         !3, 'getParameters'
         28        DO_FCALL                                      0  $20     
         29        SEPARATE                                         $20     $20
         30      > FE_RESET_RW                                      $21     $20, ->71
         31    > > FE_FETCH_RW                                              $21, !4, ->71
   18    32    >   INIT_FCALL                                               'version_compare'
         33        SEND_VAL                                                 '8.0.0'
         34        SEND_VAL                                                 '7.0.0'
         35        DO_ICALL                                         $22     
         36        IS_SMALLER_OR_EQUAL                                      0, $22
         37      > JMPZ                                                     ~23, ->52
   19    38    >   INIT_METHOD_CALL                                         !4, 'hasType'
         39        DO_FCALL                                      0  $24     
         40      > JMPZ                                                     $24, ->52
   20    41    >   INIT_METHOD_CALL                                         !4, 'getType'
         42        DO_FCALL                                      0  $25     
         43        INIT_METHOD_CALL                                         !4, 'allowsNull'
         44        DO_FCALL                                      0  $26     
         45      > JMPZ                                                     $26, ->48
         46    >   QM_ASSIGN                                        ~27     '%7Cnull'
         47      > JMP                                                      ->49
         48    >   QM_ASSIGN                                        ~27     ''
         49    >   CONCAT                                           ~28     $25, ~27
         50        CONCAT                                           ~29     ~28, '+'
         51        ECHO                                                     ~29
   23    52    >   INIT_METHOD_CALL                                         !4, 'isOptional'
         53        DO_FCALL                                      0  $30     
         54      > JMPZ                                                     $30, ->57
         55    >   QM_ASSIGN                                        ~31     '%5B'
         56      > JMP                                                      ->58
         57    >   QM_ASSIGN                                        ~31     ''
         58    >   INIT_METHOD_CALL                                         !4, 'getName'
         59        DO_FCALL                                      0  $32     
         60        CONCAT                                           ~33     ~31, $32
         61        INIT_METHOD_CALL                                         !4, 'isOptional'
         62        DO_FCALL                                      0  $34     
         63      > JMPZ                                                     $34, ->66
         64    >   QM_ASSIGN                                        ~35     '%5D'
         65      > JMP                                                      ->67
         66    >   QM_ASSIGN                                        ~35     ''
         67    >   CONCAT                                           ~36     ~33, ~35
         68        ECHO                                                     ~36
   24    69        ECHO                                                     '%3B+'
   16    70      > JMP                                                      ->31
         71    >   FE_FREE                                                  $21
   26    72        ECHO                                                     '%5D'
   28    73        ECHO                                                     '%0A%0A%0A'
   10    74      > JMP                                                      ->8
         75    >   FE_FREE                                                  $10
   30    76      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FuufKo%3A2%240

Function %00%7Bclosure%7D%2Fin%2FuufKo%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uufKo
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $param1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'mb_strlen'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    8     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FuufKo%3A6%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.46 ms | 1404 KiB | 17 Q