3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! cymk derp.png', ' this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! cymk x.png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! this is a test.png ', 'this is a test! this is a test! this is a test! this is a test! this is a test! this is a - - - - - - test.png', ]; foreach ( $tests as $originalFilename) { $filteredFilename = str_replace(' ', '-', strtolower(trim($originalFilename))); $filteredFilename = substr( $filteredFilename, 0, strrpos($filteredFilename,'.') ); $filteredFilename = str_replace('cmyk','',$filteredFilename); $filteredFilename = preg_replace('/(cmyk)|([^a-z0-9]+)|(\-+$)/','',$filteredFilename); $filteredFilename = preg_replace('/-{2,}/','-',$filteredFilename); if ( strlen($filteredFilename) > 80 ) { if ($filteredFilename[81] === '-') { $filteredFilename = substr($filteredFilename, 0, 80); } else { echo strrpos($filteredFilename, '-', 80); $filteredFilename = substr($filteredFilename, 0, 80); } } echo $filteredFilename; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 70
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 70
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 68
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 56
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 68
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
filename:       /in/StODD
function name:  (null)
number of ops:  72
compiled vars:  !0 = $tests, !1 = $originalFilename, !2 = $filteredFilename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   12     1      > FE_RESET_R                                       $4      !0, ->70
          2    > > FE_FETCH_R                                               $4, !1, ->70
   15     3    >   INIT_FCALL                                               'str_replace'
          4        SEND_VAL                                                 '+'
          5        SEND_VAL                                                 '-'
          6        INIT_FCALL                                               'strtolower'
          7        INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                         $7      
         14        ASSIGN                                                   !2, $7
   17    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 0
         18        INIT_FCALL                                               'strrpos'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 '.'
         21        DO_ICALL                                         $9      
         22        SEND_VAR                                                 $9
         23        DO_ICALL                                         $10     
         24        ASSIGN                                                   !2, $10
   19    25        INIT_FCALL                                               'str_replace'
         26        SEND_VAL                                                 'cmyk'
         27        SEND_VAL                                                 ''
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $12     
         30        ASSIGN                                                   !2, $12
   21    31        INIT_FCALL                                               'preg_replace'
         32        SEND_VAL                                                 '%2F%28cmyk%29%7C%28%5B%5Ea-z0-9%5D%2B%29%7C%28%5C-%2B%24%29%2F'
         33        SEND_VAL                                                 ''
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                         $14     
         36        ASSIGN                                                   !2, $14
   23    37        INIT_FCALL                                               'preg_replace'
         38        SEND_VAL                                                 '%2F-%7B2%2C%7D%2F'
         39        SEND_VAL                                                 '-'
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                         $16     
         42        ASSIGN                                                   !2, $16
   25    43        STRLEN                                           ~18     !2
         44        IS_SMALLER                                               80, ~18
         45      > JMPZ                                                     ~19, ->68
   26    46    >   FETCH_DIM_R                                      ~20     !2, 81
         47        IS_IDENTICAL                                             ~20, '-'
         48      > JMPZ                                                     ~21, ->56
   27    49    >   INIT_FCALL                                               'substr'
         50        SEND_VAR                                                 !2
         51        SEND_VAL                                                 0
         52        SEND_VAL                                                 80
         53        DO_ICALL                                         $22     
         54        ASSIGN                                                   !2, $22
         55      > JMP                                                      ->68
   29    56    >   INIT_FCALL                                               'strrpos'
         57        SEND_VAR                                                 !2
         58        SEND_VAL                                                 '-'
         59        SEND_VAL                                                 80
         60        DO_ICALL                                         $24     
         61        ECHO                                                     $24
   30    62        INIT_FCALL                                               'substr'
         63        SEND_VAR                                                 !2
         64        SEND_VAL                                                 0
         65        SEND_VAL                                                 80
         66        DO_ICALL                                         $25     
         67        ASSIGN                                                   !2, $25
   34    68    >   ECHO                                                     !2
   12    69      > JMP                                                      ->2
         70    >   FE_FREE                                                  $4
   35    71      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.96 ms | 1400 KiB | 25 Q