3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ([ 'boolean' => 'true', 'double' => '1.2', 'integer' => '1', 'resource' => 'STDOUT', ] as $type => $value) { $functionName = "foo_{$type}"; $code = <<<EOT function {$functionName}({$type} \$i) { } {$functionName}({$value}); EOT; echo "Testing {$type} with\n", str_replace($functionName, 'foo', $code), "\nresults in:\n "; try { eval($code); echo "success.\n"; } catch (TypeError $e) { $message = str_replace($functionName, 'foo', $e->getMessage()); $message = substr($message, 0, strpos($message, ', called in ')); echo $message, "\n"; } echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 53
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 53
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
Found catch point at position: 30
Branch analysis from position: 30
2 jumps found. (Code = 107) Position 1 = 31, Position 2 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
filename:       /in/816pM
function name:  (null)
number of ops:  55
compiled vars:  !0 = $value, !1 = $type, !2 = $functionName, !3 = $code, !4 = $e, !5 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > FE_RESET_R                                       $6      <array>, ->53
          1    > > FE_FETCH_R                                       ~7      $6, !0, ->53
    8     2    >   ASSIGN                                                   !1, ~7
    9     3        NOP                                                      
          4        FAST_CONCAT                                      ~9      'foo_', !1
          5        ASSIGN                                                   !2, ~9
   11     6        ROPE_INIT                                     9  ~12     '++++function+'
          7        ROPE_ADD                                      1  ~12     ~12, !2
          8        ROPE_ADD                                      2  ~12     ~12, '%28'
          9        ROPE_ADD                                      3  ~12     ~12, !1
         10        ROPE_ADD                                      4  ~12     ~12, '+%24i%29%0A++++%7B%0A++++%7D%0A++++'
   14    11        ROPE_ADD                                      5  ~12     ~12, !2
         12        ROPE_ADD                                      6  ~12     ~12, '%28'
         13        ROPE_ADD                                      7  ~12     ~12, !0
         14        ROPE_END                                      8  ~11     ~12, '%29%3B'
   10    15        ASSIGN                                                   !3, ~11
   16    16        ROPE_INIT                                     3  ~19     'Testing+'
         17        ROPE_ADD                                      1  ~19     ~19, !1
         18        ROPE_END                                      2  ~18     ~19, '+with%0A'
         19        ECHO                                                     ~18
         20        INIT_FCALL                                               'str_replace'
         21        SEND_VAR                                                 !2
         22        SEND_VAL                                                 'foo'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $21     
         25        ECHO                                                     $21
         26        ECHO                                                     '%0Aresults+in%3A%0A++++'
   18    27        INCLUDE_OR_EVAL                                          !3, EVAL
   19    28        ECHO                                                     'success.%0A'
         29      > JMP                                                      ->51
   20    30  E > > CATCH                                       last         'TypeError'
   21    31    >   INIT_FCALL                                               'str_replace'
         32        SEND_VAR                                                 !2
         33        SEND_VAL                                                 'foo'
         34        INIT_METHOD_CALL                                         !4, 'getMessage'
         35        DO_FCALL                                      0  $23     
         36        SEND_VAR                                                 $23
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !5, $24
   22    39        INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !5
         41        SEND_VAL                                                 0
         42        INIT_FCALL                                               'strpos'
         43        SEND_VAR                                                 !5
         44        SEND_VAL                                                 '%2C+called+in+'
         45        DO_ICALL                                         $26     
         46        SEND_VAR                                                 $26
         47        DO_ICALL                                         $27     
         48        ASSIGN                                                   !5, $27
   23    49        ECHO                                                     !5
         50        ECHO                                                     '%0A'
   25    51    >   ECHO                                                     '%0A'
    4    52      > JMP                                                      ->1
         53    >   FE_FREE                                                  $6
   26    54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.47 ms | 1400 KiB | 19 Q