3v4l.org

run code in 500+ 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 = 41
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 41
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Found catch point at position: 27
Branch analysis from position: 27
2 jumps found. (Code = 107) Position 1 = 28, Position 2 = -2
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
filename:       /in/816pM
function name:  (null)
number of ops:  43
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>, ->41
          1    > > FE_FETCH_R                                           ~7      $6, !0, ->41
    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        FRAMELESS_ICALL_3                str_replace         ~21     !2, 'foo'
         21        OP_DATA                                                      !3
         22        ECHO                                                         ~21
         23        ECHO                                                         '%0Aresults+in%3A%0A++++'
   18    24        INCLUDE_OR_EVAL                                              !3, EVAL
   19    25        ECHO                                                         'success.%0A'
         26      > JMP                                                          ->39
   20    27  E > > CATCH                                           last         'TypeError'
   21    28    >   INIT_METHOD_CALL                                             !4, 'getMessage'
         29        DO_FCALL                                          0  $23     
         30        FRAMELESS_ICALL_3                str_replace         ~24     !2, 'foo'
         31        OP_DATA                                                      $23
         32        ASSIGN                                                       !5, ~24
   22    33        FRAMELESS_ICALL_2                strpos              ~26     !5, '%2C+called+in+'
         34        FRAMELESS_ICALL_3                substr              ~27     !5, 0
         35        OP_DATA                                                      ~26
         36        ASSIGN                                                       !5, ~27
   23    37        ECHO                                                         !5
         38        ECHO                                                         '%0A'
   25    39    >   ECHO                                                         '%0A'
    4    40      > JMP                                                          ->1
         41    >   FE_FREE                                                      $6
   26    42      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
175.04 ms | 3710 KiB | 13 Q