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); echo substr($a, $pos, -4) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 25
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/sqHTb
function name:  (null)
number of ops:  27
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, ->25
          2    > > FE_FETCH_R                                               $6, !1, ->25
    8     3    >   STRLEN                                           ~7      !1
          4        ASSIGN                                                   !2, ~7
   10     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
   12    11        INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 '.'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $12     
         16        ASSIGN                                                   !4, $12
   14    17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !4
         20        SEND_VAL                                                 -4
         21        DO_ICALL                                         $14     
         22        CONCAT                                           ~15     $14, '%0A'
         23        ECHO                                                     ~15
    6    24      > JMP                                                      ->2
         25    >   FE_FREE                                                  $6
   15    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.85 ms | 1395 KiB | 19 Q