3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "en/", "en/account/login", "en/account/dashboard", "fa/account/login" ]; $langs = ["en", "fa"]; foreach ($strings as $string) { $parts = explode('/', $string); if (in_array($parts[0], $langs)) { array_shift($parts); } echo implode('/', $parts) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/uKRbA
function name:  (null)
number of ops:  27
compiled vars:  !0 = $strings, !1 = $langs, !2 = $string, !3 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   12     2      > FE_RESET_R                                       $6      !0, ->25
          3    > > FE_FETCH_R                                               $6, !2, ->25
   13     4    >   INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2F'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   14     9        INIT_FCALL                                               'in_array'
         10        FETCH_DIM_R                                      ~9      !3, 0
         11        SEND_VAL                                                 ~9
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $10     
         14      > JMPZ                                                     $10, ->18
   15    15    >   INIT_FCALL                                               'array_shift'
         16        SEND_REF                                                 !3
         17        DO_ICALL                                                 
   17    18    >   INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '%2F'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $12     
         22        CONCAT                                           ~13     $12, '%0A'
         23        ECHO                                                     ~13
   12    24      > JMP                                                      ->3
         25    >   FE_FREE                                                  $6
   18    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.98 ms | 1401 KiB | 21 Q