3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/(EC)\w{2}|(CC)\w{2}|\w(F)\w{2}|(LT)\w{2}|\w(T)\w{2}/'; $str = 'STAR'; preg_match($re, $str, $matches); // Remove empty values and reset keys $cat = array_values(array_filter($matches)); $categories = [ 'CB' => 'Compact', 'CC' => 'Compact', 'CD' => 'Compact', 'EB' => 'Economy', 'EC' => 'Economy', 'ED' => 'Economy', 'IB' => 'Mid-Size', 'IC' => 'Mid-Size', 'ID' => 'Mid-Size', 'PB' => 'Premium', 'PC' => 'Premium', 'PD' => 'Premium', 'SB' => 'Standard', 'SC' => 'Standard', 'SD' => 'Standard', '0L' => 'Luxury', 'F' => 'SUV', '1G' => 'Crossover', '1K' => 'Commercial', '1P' => 'Pickup Truck', '1Q' => 'Pickup Truck', '1R' => 'RV', '1S' => 'Sports', 'T' => 'Convertible', '1V' => 'Van', '1W' => 'Wagon', '3H' => 'Hybrid', '3I' => 'Hybrid', '3C' => 'Electric', '3E' => 'Electric', ]; //Echo category Echo $categories[$cat[1]];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Sg5Xe
function name:  (null)
number of ops:  19
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $cat, !4 = $categories
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28EC%29%5Cw%7B2%7D%7C%28CC%29%5Cw%7B2%7D%7C%5Cw%28F%29%5Cw%7B2%7D%7C%28LT%29%5Cw%7B2%7D%7C%5Cw%28T%29%5Cw%7B2%7D%2F'
    4     1        ASSIGN                                                   !1, 'STAR'
    6     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    9     7        INIT_FCALL                                               'array_values'
          8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $8      
         11        SEND_VAR                                                 $8
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !3, $9
   11    14        ASSIGN                                                   !4, <array>
   52    15        FETCH_DIM_R                                      ~12     !3, 1
         16        FETCH_DIM_R                                      ~13     !4, ~12
         17        ECHO                                                     ~13
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.95 ms | 1428 KiB | 16 Q