3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = ['filename.en_us.srt', 'filename.en_uk.srt']; foreach($ar as $a) { $len = strlen($a); $dotcount = substr_count($a, '.') -1; $pos = strpos($a, '.', $dotcount+1); echo substr($a, $pos, -4) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 26
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/bfabS
function name:  (null)
number of ops:  28
compiled vars:  !0 = $ar, !1 = $a, !2 = $len, !3 = $dotcount, !4 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1      > FE_RESET_R                                       $6      !0, ->26
          2    > > FE_FETCH_R                                               $6, !1, ->26
    8     3    >   STRLEN                                           ~7      !1
          4        ASSIGN                                                   !2, ~7
    9     5        INIT_FCALL                                               'substr_count'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 '.'
          8        DO_ICALL                                         $9      
          9        SUB                                              ~10     $9, 1
         10        ASSIGN                                                   !3, ~10
   10    11        INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 '.'
         14        ADD                                              ~12     !3, 1
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !4, $13
   11    18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !1
         20        SEND_VAR                                                 !4
         21        SEND_VAL                                                 -4
         22        DO_ICALL                                         $15     
         23        CONCAT                                           ~16     $15, '%0A'
         24        ECHO                                                     ~16
    6    25      > JMP                                                      ->2
         26    >   FE_FREE                                                  $6
   12    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.38 ms | 1395 KiB | 19 Q