3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* 1. Create a file called test.txt 2. Zip that file into a file called test.zip 3. Uncomment the last line in this code 4. Run this code against PHP 7.4, 8.0 and 8.1 5. Note that 8.1 throws an exception */ class XYZ { private function getFilePointer($file) { $zip = new ZipArchive(); if (!$zip->open($file)) { throw new Exception("error"); } $fileName = 'test.txt'; if (!($stream = $zip->getStream($fileName))) { throw new Exception("error"); } return $stream; } public function doWork() { $stream = $this->getFilePointer('test.zip'); fgetcsv($stream); } } // Uncomment to run // (new XYZ())->doWork();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oALrq
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E > > RETURN                                                   1

Class XYZ:
Function getfilepointer:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oALrq
function name:  getFilePointer
number of ops:  26
compiled vars:  !0 = $file, !1 = $zip, !2 = $fileName, !3 = $stream
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        NEW                                              $4      'ZipArchive'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
   16     4        INIT_METHOD_CALL                                         !1, 'open'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $7      
          7        BOOL_NOT                                         ~8      $7
          8      > JMPZ                                                     ~8, ->13
   17     9    >   NEW                                              $9      'Exception'
         10        SEND_VAL_EX                                              'error'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $9
   20    13    >   ASSIGN                                                   !2, 'test.txt'
   22    14        INIT_METHOD_CALL                                         !1, 'getStream'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $12     
         17        ASSIGN                                           ~13     !3, $12
         18        BOOL_NOT                                         ~14     ~13
         19      > JMPZ                                                     ~14, ->24
   23    20    >   NEW                                              $15     'Exception'
         21        SEND_VAL_EX                                              'error'
         22        DO_FCALL                                      0          
         23      > THROW                                         0          $15
   26    24    > > RETURN                                                   !3
   27    25*     > RETURN                                                   null

End of function getfilepointer

Function dowork:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oALrq
function name:  doWork
number of ops:  8
compiled vars:  !0 = $stream
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_METHOD_CALL                                         'getFilePointer'
          1        SEND_VAL                                                 'test.zip'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   33     4        INIT_FCALL                                               'fgetcsv'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   34     7      > RETURN                                                   null

End of function dowork

End of class XYZ.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.26 ms | 1015 KiB | 14 Q