3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dir = sys_get_temp_dir() . '/decompress-demo-' . getmypid(); mkdir($dir); $archive = new PharData("$dir/my.tar"); $archive['myfile.txt'] = 'hi'; $compressed = $archive->compress(Phar::GZ); // creates my.tar.gz // The default name, my.tar, is taken by the original archive try { $compressed->decompress(); } catch (BadMethodCallException $e) { echo $e->getMessage(), "\n"; } // The copy is written next to my.tar.gz, not in the working directory chdir(sys_get_temp_dir()); $decompressed = $compressed->decompress('decompressed.tar'); var_dump(file_exists("$dir/my.tar.gz"), file_exists("$dir/my.decompressed.tar")); var_dump(file_exists(getcwd() . '/my.decompressed.tar')); var_dump($compressed->isCompressed(), $decompressed->isCompressed());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 25
Branch analysis from position: 25
2 jumps found. (Code = 107) Position 1 = 26, Position 2 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/imGVA
function name:  (null)
number of ops:  71
compiled vars:  !0 = $dir, !1 = $archive, !2 = $compressed, !3 = $e, !4 = $decompressed
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'sys_get_temp_dir'
          1        DO_ICALL                                             $5      
          2        CONCAT                                               ~6      $5, '%2Fdecompress-demo-'
          3        INIT_FCALL                                                   'getmypid'
          4        DO_ICALL                                             $7      
          5        CONCAT                                               ~8      ~6, $7
          6        ASSIGN                                                       !0, ~8
    3     7        INIT_FCALL                                                   'mkdir'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                                     
    5    10        NEW                                                  $11     'PharData'
         11        NOP                                                          
         12        FAST_CONCAT                                          ~12     !0, '%2Fmy.tar'
         13        SEND_VAL_EX                                                  ~12
         14        DO_FCALL                                          0          
         15        ASSIGN                                                       !1, $11
    6    16        ASSIGN_DIM                                                   !1, 'myfile.txt'
         17        OP_DATA                                                      'hi'
    7    18        INIT_METHOD_CALL                                             !1, 'compress'
         19        SEND_VAL_EX                                                  4096
         20        DO_FCALL                                          0  $16     
         21        ASSIGN                                                       !2, $16
   11    22        INIT_METHOD_CALL                                             !2, 'decompress'
         23        DO_FCALL                                          0          
         24      > JMP                                                          ->30
   12    25  E > > CATCH                                           last         'BadMethodCallException'
   13    26    >   INIT_METHOD_CALL                                             !3, 'getMessage'
         27        DO_FCALL                                          0  $19     
         28        ECHO                                                         $19
         29        ECHO                                                         '%0A'
   17    30    >   INIT_FCALL                                                   'chdir'
         31        INIT_FCALL                                                   'sys_get_temp_dir'
         32        DO_ICALL                                             $20     
         33        SEND_VAR                                                     $20
         34        DO_ICALL                                                     
   18    35        INIT_METHOD_CALL                                             !2, 'decompress'
         36        SEND_VAL_EX                                                  'decompressed.tar'
         37        DO_FCALL                                          0  $22     
         38        ASSIGN                                                       !4, $22
   20    39        INIT_FCALL                                                   'var_dump'
         40        INIT_FCALL                                                   'file_exists'
         41        NOP                                                          
         42        FAST_CONCAT                                          ~24     !0, '%2Fmy.tar.gz'
         43        SEND_VAL                                                     ~24
         44        DO_ICALL                                             $25     
         45        SEND_VAR                                                     $25
         46        INIT_FCALL                                                   'file_exists'
         47        NOP                                                          
         48        FAST_CONCAT                                          ~26     !0, '%2Fmy.decompressed.tar'
         49        SEND_VAL                                                     ~26
         50        DO_ICALL                                             $27     
         51        SEND_VAR                                                     $27
         52        DO_ICALL                                                     
   21    53        INIT_FCALL                                                   'var_dump'
         54        INIT_FCALL                                                   'file_exists'
         55        INIT_FCALL                                                   'getcwd'
         56        DO_ICALL                                             $29     
         57        CONCAT                                               ~30     $29, '%2Fmy.decompressed.tar'
         58        SEND_VAL                                                     ~30
         59        DO_ICALL                                             $31     
         60        SEND_VAR                                                     $31
         61        DO_ICALL                                                     
   22    62        INIT_FCALL                                                   'var_dump'
         63        INIT_METHOD_CALL                                             !2, 'isCompressed'
         64        DO_FCALL                                          0  $33     
         65        SEND_VAR                                                     $33
         66        INIT_METHOD_CALL                                             !4, 'isCompressed'
         67        DO_FCALL                                          0  $34     
         68        SEND_VAR                                                     $34
         69        DO_ICALL                                                     
         70      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.84 ms | 498 KiB | 16 Q