3v4l.org

run code in 500+ PHP versions simultaneously
<?php $test_cases = array( "abc.txt" => '.', "https://3v4l.org/?foo" => '?', "https://3v4l.org/#bar" => '#', $_SERVER['PATH'] => ':', "PHP 8.3.8" => ' ', "192.168.1.1" => '.', "foo\nbar" => "\n", "snake_case" => '_', ); foreach ($test_cases as $string => $char) { if (strtok($string,$char)==pathinfo($string, PATHINFO_FILENAME)) { echo "\n\nSUCCESS: {$string} => {$char}"; } else { $string = str_replace("\n","\\n",$string); $char = str_replace("\n","\\n",$char); echo "\n\nFAILED: {$string} => {$char}"; echo "\n- strtok(): " . strtok($string,$char); echo "\n- pathinfo(): " . pathinfo($string, PATHINFO_FILENAME); }; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 54
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 54
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/RDYFs
function name:  (null)
number of ops:  56
compiled vars:  !0 = $test_cases, !1 = $char, !2 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                           ~3      '.', 'abc.txt'
    5     1        ADD_ARRAY_ELEMENT                                    ~3      '%3F', 'https%3A%2F%2F3v4l.org%2F%3Ffoo'
    6     2        ADD_ARRAY_ELEMENT                                    ~3      '%23', 'https%3A%2F%2F3v4l.org%2F%23bar'
    7     3        FETCH_R                          global              ~4      '_SERVER'
          4        FETCH_DIM_R                                          ~5      ~4, 'PATH'
          5        ADD_ARRAY_ELEMENT                                    ~3      '%3A', ~5
    8     6        ADD_ARRAY_ELEMENT                                    ~3      '+', 'PHP+8.3.8'
    9     7        ADD_ARRAY_ELEMENT                                    ~3      '.', '192.168.1.1'
   10     8        ADD_ARRAY_ELEMENT                                    ~3      '%0A', 'foo%0Abar'
   11     9        ADD_ARRAY_ELEMENT                                    ~3      '_', 'snake_case'
    3    10        ASSIGN                                                       !0, ~3
   13    11      > FE_RESET_R                                           $7      !0, ->54
         12    > > FE_FETCH_R                                           ~8      $7, !1, ->54
         13    >   ASSIGN                                                       !2, ~8
   14    14        INIT_FCALL                                                   'strtok'
         15        SEND_VAR                                                     !2
         16        SEND_VAR                                                     !1
         17        DO_ICALL                                             $10     
         18        INIT_FCALL                                                   'pathinfo'
         19        SEND_VAR                                                     !2
         20        SEND_VAL                                                     8
         21        DO_ICALL                                             $11     
         22        IS_EQUAL                                                     $10, $11
         23      > JMPZ                                                         ~12, ->30
   15    24    >   ROPE_INIT                                         4  ~14     '%0A%0ASUCCESS%3A+'
         25        ROPE_ADD                                          1  ~14     ~14, !2
         26        ROPE_ADD                                          2  ~14     ~14, '+%3D%3E+'
         27        ROPE_END                                          3  ~13     ~14, !1
         28        ECHO                                                         ~13
   14    29      > JMP                                                          ->53
   17    30    >   FRAMELESS_ICALL_3                str_replace         ~16     '%0A', '%5Cn'
         31        OP_DATA                                                      !2
         32        ASSIGN                                                       !2, ~16
   18    33        FRAMELESS_ICALL_3                str_replace         ~18     '%0A', '%5Cn'
         34        OP_DATA                                                      !1
         35        ASSIGN                                                       !1, ~18
   19    36        ROPE_INIT                                         4  ~21     '%0A%0AFAILED%3A+'
         37        ROPE_ADD                                          1  ~21     ~21, !2
         38        ROPE_ADD                                          2  ~21     ~21, '+%3D%3E+'
         39        ROPE_END                                          3  ~20     ~21, !1
         40        ECHO                                                         ~20
   20    41        INIT_FCALL                                                   'strtok'
         42        SEND_VAR                                                     !2
         43        SEND_VAR                                                     !1
         44        DO_ICALL                                             $23     
         45        CONCAT                                               ~24     '%0A-+strtok%28%29%3A+++', $23
         46        ECHO                                                         ~24
   21    47        INIT_FCALL                                                   'pathinfo'
         48        SEND_VAR                                                     !2
         49        SEND_VAL                                                     8
         50        DO_ICALL                                             $25     
         51        CONCAT                                               ~26     '%0A-+pathinfo%28%29%3A+', $25
         52        ECHO                                                         ~26
   13    53    > > JMP                                                          ->12
         54    >   FE_FREE                                                      $7
   23    55      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.59 ms | 1414 KiB | 16 Q