3v4l.org

run code in 300+ PHP versions simultaneously
<?php function open_image ($file) { // Get extension $extension = strrchr($file, '.'); $extension = strtolower($extension); switch($extension) { case '.jpg': $im = $file; break; case '.jpeg': $im = @imagecreatefromjpeg($file); break; case '.gif': $im = @imagecreatefromgif($file); break; case '.tiff': $im = @imagecreatefromtiff($file); break; // ... etc default: $im = false; break; } return $im; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T2t3s
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E > > RETURN                                                   1

Function open_image:
Finding entry points
Branch analysis from position: 0
6 jumps found. (Code = 188) Position 1 = 20, Position 2 = 22, Position 3 = 29, Position 4 = 36, Position 5 = 43, Position 6 = 11
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 36
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 36
Branch analysis from position: 29
Branch analysis from position: 22
Branch analysis from position: 20
filename:       /in/T2t3s
function name:  open_image
number of ops:  47
compiled vars:  !0 = $file, !1 = $extension, !2 = $im
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'strrchr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '.'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    8     6        INIT_FCALL                                               'strtolower'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   10    10      > SWITCH_STRING                                            !1, [ '.jpg':->20, '.jpeg':->22, '.gif':->29, '.tiff':->36, ], ->43
   11    11    >   IS_EQUAL                                                 !1, '.jpg'
         12      > JMPNZ                                                    ~7, ->20
   14    13    >   IS_EQUAL                                                 !1, '.jpeg'
         14      > JMPNZ                                                    ~7, ->22
   17    15    >   IS_EQUAL                                                 !1, '.gif'
         16      > JMPNZ                                                    ~7, ->29
   20    17    >   IS_EQUAL                                                 !1, '.tiff'
         18      > JMPNZ                                                    ~7, ->36
         19    > > JMP                                                      ->43
   12    20    >   ASSIGN                                                   !2, !0
   13    21      > JMP                                                      ->45
   15    22    >   BEGIN_SILENCE                                    ~9      
         23        INIT_FCALL_BY_NAME                                       'imagecreatefromjpeg'
         24        SEND_VAR_EX                                              !0
         25        DO_FCALL                                      0  $10     
         26        END_SILENCE                                              ~9
         27        ASSIGN                                                   !2, $10
   16    28      > JMP                                                      ->45
   18    29    >   BEGIN_SILENCE                                    ~12     
         30        INIT_FCALL_BY_NAME                                       'imagecreatefromgif'
         31        SEND_VAR_EX                                              !0
         32        DO_FCALL                                      0  $13     
         33        END_SILENCE                                              ~12
         34        ASSIGN                                                   !2, $13
   19    35      > JMP                                                      ->45
   21    36    >   BEGIN_SILENCE                                    ~15     
         37        INIT_FCALL_BY_NAME                                       'imagecreatefromtiff'
         38        SEND_VAR_EX                                              !0
         39        DO_FCALL                                      0  $16     
         40        END_SILENCE                                              ~15
         41        ASSIGN                                                   !2, $16
   22    42      > JMP                                                      ->45
   27    43    >   ASSIGN                                                   !2, <false>
   28    44      > JMP                                                      ->45
   32    45    > > RETURN                                                   !2
   33    46*     > RETURN                                                   null

End of function open_image

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.16 ms | 1400 KiB | 17 Q