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) { if ((version_compare(PHP_VERSION, '7.0.0') >= 0) and $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 = 76
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 76
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 = 72
Branch analysis from position: 31
2 jumps found. (Code = 126) Position 1 = 32, Position 2 = 72
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 53
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 58
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 67
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 67
Branch analysis from position: 65
Branch analysis from position: 67
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 58
Branch analysis from position: 56
Branch analysis from position: 58
Branch analysis from position: 53
Branch analysis from position: 41
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 72
Branch analysis from position: 23
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
filename:       /in/49s1p
function name:  (null)
number of ops:  78
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%2F49s1p%3A2%240'
          1        ASSIGN                                                   !0, ~5
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F49s1p%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, ->76
          8    > > FE_FETCH_RW                                              $10, !2, ->76
   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, ->72
         31    > > FE_FETCH_RW                                              $21, !4, ->72
   17    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                              ~23     0, $22
         37      > JMPZ_EX                                          ~23     ~23, ->41
         38    >   INIT_METHOD_CALL                                         !4, 'hasType'
         39        DO_FCALL                                      0  $24     
         40        BOOL                                             ~23     $24
         41    > > JMPZ                                                     ~23, ->53
   18    42    >   INIT_METHOD_CALL                                         !4, 'getType'
         43        DO_FCALL                                      0  $25     
         44        INIT_METHOD_CALL                                         !4, 'allowsNull'
         45        DO_FCALL                                      0  $26     
         46      > JMPZ                                                     $26, ->49
         47    >   QM_ASSIGN                                        ~27     '%7Cnull'
         48      > JMP                                                      ->50
         49    >   QM_ASSIGN                                        ~27     ''
         50    >   CONCAT                                           ~28     $25, ~27
         51        CONCAT                                           ~29     ~28, '+'
         52        ECHO                                                     ~29
   20    53    >   INIT_METHOD_CALL                                         !4, 'isOptional'
         54        DO_FCALL                                      0  $30     
         55      > JMPZ                                                     $30, ->58
         56    >   QM_ASSIGN                                        ~31     '%5B'
         57      > JMP                                                      ->59
         58    >   QM_ASSIGN                                        ~31     ''
         59    >   INIT_METHOD_CALL                                         !4, 'getName'
         60        DO_FCALL                                      0  $32     
         61        CONCAT                                           ~33     ~31, $32
         62        INIT_METHOD_CALL                                         !4, 'isOptional'
         63        DO_FCALL                                      0  $34     
         64      > JMPZ                                                     $34, ->67
         65    >   QM_ASSIGN                                        ~35     '%5D'
         66      > JMP                                                      ->68
         67    >   QM_ASSIGN                                        ~35     ''
         68    >   CONCAT                                           ~36     ~33, ~35
         69        ECHO                                                     ~36
   21    70        ECHO                                                     '%3B+'
   16    71      > JMP                                                      ->31
         72    >   FE_FREE                                                  $21
   23    73        ECHO                                                     '%5D'
   25    74        ECHO                                                     '%0A%0A%0A'
   10    75      > JMP                                                      ->8
         76    >   FE_FREE                                                  $10
   27    77      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F49s1p%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49s1p
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%2F49s1p%3A2%240

Function %00%7Bclosure%7D%2Fin%2F49s1p%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49s1p
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%2F49s1p%3A6%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
242.79 ms | 1404 KiB | 17 Q