3v4l.org

run code in 500+ PHP versions simultaneously
<?php $currencies = [ 'USD', 'BTC', 'DASH', 'LTC', 'SC', 'STEEM', 'WAVES', 'SNGLS', '1ST', 'BQX', 'ETH', 'PTOY', 'XAUR', ]; $input = [ "BTCUSD", "DASHBTC", "DOGEUSD", "LTCBTC", "LTCUSD", "SCBTC", "STEEMBTC", "WAVESBTC", "SNGLSBTC", "1STBTC", "DASHUSD", "BQXETH", "PTOYETH", "XAURETH", "BTCUSDT", ]; $output=[]; foreach($input as $doubleCurrency){ foreach($currencies as $currency){ $pattern = '/^'.$currency. '/'; preg_match($pattern, $doubleCurrency, $matches); if(array_key_exists(0, $matches)){ $output[]=$matches[0]; } } } var_dump($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/6mMbN
function name:  (null)
number of ops:  28
compiled vars:  !0 = $currencies, !1 = $input, !2 = $output, !3 = $doubleCurrency, !4 = $currency, !5 = $pattern, !6 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   19     1        ASSIGN                                                       !1, <array>
   37     2        ASSIGN                                                       !2, <array>
   38     3      > FE_RESET_R                                           $10     !1, ->23
          4    > > FE_FETCH_R                                                   $10, !3, ->23
   39     5    > > FE_RESET_R                                           $11     !0, ->21
          6    > > FE_FETCH_R                                                   $11, !4, ->21
   40     7    >   CONCAT                                               ~12     '%2F%5E', !4
          8        CONCAT                                               ~13     ~12, '%2F'
          9        ASSIGN                                                       !5, ~13
   41    10        INIT_FCALL                                                   'preg_match'
         11        SEND_VAR                                                     !5
         12        SEND_VAR                                                     !3
         13        SEND_REF                                                     !6
         14        DO_ICALL                                                     
   42    15        ARRAY_KEY_EXISTS                                             0, !6
         16      > JMPZ                                                         ~16, ->20
   43    17    >   FETCH_DIM_R                                          ~18     !6, 0
         18        ASSIGN_DIM                                                   !2
         19        OP_DATA                                                      ~18
   39    20    > > JMP                                                          ->6
         21    >   FE_FREE                                                      $11
   38    22      > JMP                                                          ->4
         23    >   FE_FREE                                                      $10
   48    24        INIT_FCALL                                                   'var_dump'
         25        SEND_VAR                                                     !2
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.94 ms | 2682 KiB | 15 Q