3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tests=[ 'Non-Images Only'=>'filename 1 (https://example.com/test.exe)', 'Mixed-Type'=>'filename 1 (https://example.com/test.pdf), filename 2 (https://example.com/cool_image.jpg), filename 3 (https://example.com/other-file.docx), filename 4 (https://example.com/nice_image.png)', 'No Files'=>'filename 1 (), filename 2 ()', 'Images-Only'=>'filename 1 (https://example.com/another.png), filename 2 (https://example.com/cool_image.jpg))']; $image_pattern='~\.(?:png|gif|jpe?g|bmp)\),?$~im'; $non_image_pattern='~\.(?:(?:png|gif|jpe?g|bmp)(*SKIP)(*FAIL)|[^.)]+)\),?$~im'; foreach($tests as $type=>$string){ echo "\t\tAssessing:\n---\n"; echo "$string\n---\n"; echo "Expecting: $type\n"; echo "Assessed as: "; $has_image=preg_match($image_pattern,$string); $has_non_image=preg_match($non_image_pattern,$string); if($has_image){ if($has_non_image){ echo "Mix of image and non-image files"; }else{ echo "Purely image files"; } }else{ if($has_non_image){ echo "Purely non-image files"; }else{ echo "No files recognized"; } } echo "\n----------------------------------------------------\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 31
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/KAjAL
function name:  (null)
number of ops:  33
compiled vars:  !0 = $tests, !1 = $image_pattern, !2 = $non_image_pattern, !3 = $string, !4 = $type, !5 = $has_image, !6 = $has_non_image
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   13     1        ASSIGN                                                       !1, '%7E%5C.%28%3F%3Apng%7Cgif%7Cjpe%3Fg%7Cbmp%29%5C%29%2C%3F%24%7Eim'
   14     2        ASSIGN                                                       !2, '%7E%5C.%28%3F%3A%28%3F%3Apng%7Cgif%7Cjpe%3Fg%7Cbmp%29%28%2ASKIP%29%28%2AFAIL%29%7C%5B%5E.%29%5D%2B%29%5C%29%2C%3F%24%7Eim'
   16     3      > FE_RESET_R                                           $10     !0, ->31
          4    > > FE_FETCH_R                                           ~11     $10, !3, ->31
          5    >   ASSIGN                                                       !4, ~11
   17     6        ECHO                                                         '%09%09Assessing%3A%0A---%0A'
   18     7        NOP                                                          
          8        FAST_CONCAT                                          ~13     !3, '%0A---%0A'
          9        ECHO                                                         ~13
   19    10        ROPE_INIT                                         3  ~15     'Expecting%3A+'
         11        ROPE_ADD                                          1  ~15     ~15, !4
         12        ROPE_END                                          2  ~14     ~15, '%0A'
         13        ECHO                                                         ~14
   20    14        ECHO                                                         'Assessed+as%3A+'
   21    15        FRAMELESS_ICALL_2                preg_match          ~17     !1, !3
         16        ASSIGN                                                       !5, ~17
   22    17        FRAMELESS_ICALL_2                preg_match          ~19     !2, !3
         18        ASSIGN                                                       !6, ~19
   23    19      > JMPZ                                                         !5, ->25
   24    20    > > JMPZ                                                         !6, ->23
   25    21    >   ECHO                                                         'Mix+of+image+and+non-image+files'
   24    22      > JMP                                                          ->24
   27    23    >   ECHO                                                         'Purely+image+files'
   23    24    > > JMP                                                          ->29
   30    25    > > JMPZ                                                         !6, ->28
   31    26    >   ECHO                                                         'Purely+non-image+files'
   30    27      > JMP                                                          ->29
   33    28    >   ECHO                                                         'No+files+recognized'
   36    29    >   ECHO                                                         '%0A----------------------------------------------------%0A'
   16    30      > JMP                                                          ->4
         31    >   FE_FREE                                                      $10
   37    32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.02 ms | 2442 KiB | 13 Q