3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pathA = '/tmp/a.txt'; $pathB = '/tmp/b.txt'; file_put_contents($pathA, 'X'); file_put_contents($pathB, 'X'); $handleA = fopen($pathA, 'a+'); $handleB = fopen($pathB, 'a+'); assert(fwrite($handleA, 'Y') === fwrite($handleB, 'Y')); fseek($handleA, ftell($handleA)); // THIS LINE SHOULD DO NOTHING BUT CHANGES THE BEHAVIOR assert(ftell($handleA) === ftell($handleB)); $contentA = fread($handleA, 100); $contentB = fread($handleB, 100); var_dump($contentA); var_dump($contentB); assert($contentA === $contentB);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gTXsR
function name:  (null)
number of ops:  76
compiled vars:  !0 = $pathA, !1 = $pathB, !2 = $handleA, !3 = $handleB, !4 = $contentA, !5 = $contentB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Ftmp%2Fa.txt'
    4     1        ASSIGN                                                   !1, '%2Ftmp%2Fb.txt'
    6     2        INIT_FCALL                                               'file_put_contents'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'X'
          5        DO_ICALL                                                 
    7     6        INIT_FCALL                                               'file_put_contents'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 'X'
          9        DO_ICALL                                                 
    9    10        INIT_FCALL                                               'fopen'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'a%2B'
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
   10    15        INIT_FCALL                                               'fopen'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 'a%2B'
         18        DO_ICALL                                         $12     
         19        ASSIGN                                                   !3, $12
   12    20        ASSERT_CHECK                                             
         21        INIT_FCALL                                               'assert'
         22        INIT_FCALL                                               'fwrite'
         23        SEND_VAR                                                 !2
         24        SEND_VAL                                                 'Y'
         25        DO_ICALL                                         $14     
         26        INIT_FCALL                                               'fwrite'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 'Y'
         29        DO_ICALL                                         $15     
         30        IS_IDENTICAL                                     ~16     $14, $15
         31        SEND_VAL                                                 ~16
         32        SEND_VAL                                                 'assert%28fwrite%28%24handleA%2C+%27Y%27%29+%3D%3D%3D+fwrite%28%24handleB%2C+%27Y%27%29%29'
         33        DO_ICALL                                                 
   13    34        INIT_FCALL                                               'fseek'
         35        SEND_VAR                                                 !2
         36        INIT_FCALL                                               'ftell'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $18     
         39        SEND_VAR                                                 $18
         40        DO_ICALL                                                 
   14    41        ASSERT_CHECK                                             
         42        INIT_FCALL                                               'assert'
         43        INIT_FCALL                                               'ftell'
         44        SEND_VAR                                                 !2
         45        DO_ICALL                                         $20     
         46        INIT_FCALL                                               'ftell'
         47        SEND_VAR                                                 !3
         48        DO_ICALL                                         $21     
         49        IS_IDENTICAL                                     ~22     $20, $21
         50        SEND_VAL                                                 ~22
         51        SEND_VAL                                                 'assert%28ftell%28%24handleA%29+%3D%3D%3D+ftell%28%24handleB%29%29'
         52        DO_ICALL                                                 
   16    53        INIT_FCALL                                               'fread'
         54        SEND_VAR                                                 !2
         55        SEND_VAL                                                 100
         56        DO_ICALL                                         $24     
         57        ASSIGN                                                   !4, $24
   17    58        INIT_FCALL                                               'fread'
         59        SEND_VAR                                                 !3
         60        SEND_VAL                                                 100
         61        DO_ICALL                                         $26     
         62        ASSIGN                                                   !5, $26
   19    63        INIT_FCALL                                               'var_dump'
         64        SEND_VAR                                                 !4
         65        DO_ICALL                                                 
   20    66        INIT_FCALL                                               'var_dump'
         67        SEND_VAR                                                 !5
         68        DO_ICALL                                                 
   22    69        ASSERT_CHECK                                             
         70        INIT_FCALL                                               'assert'
         71        IS_IDENTICAL                                     ~30     !4, !5
         72        SEND_VAL                                                 ~30
         73        SEND_VAL                                                 'assert%28%24contentA+%3D%3D%3D+%24contentB%29'
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.87 ms | 1400 KiB | 29 Q