3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vehicles = [ 'vehicleSuper' => [ "adder", "autarch", "banshee2", "bullet" ], 'vehicleSport' => [ "alpha", "banshee", "bestiagts", "blista2" ], //... ]; $textures = [ 'candc_apartments' => [ "limo2_b", "limo2", ], 'candc_default' => [ "marshall_flag18_b", "mesa_b", "rentbus", "marshall_flag21_b", "crusader", "boxville4", "buzzard_b", "dukes2_b", "dukes", ], 'lgm_default' => [ "hotknife", "coquette", "voltic_tless", "vacca", "infernus", "cogcabri_b", "stinger_b", "banshee_b", "ztype", "ninef", "jb700", "superd", "monroe_b", "rapidgt2_b", "khamel", "comet2_b", "cheetah_b", "rapidgt_b", "stinger", "carbon_b", "surano_convertable_b", "rapidgt2", "infernus_b", "jb700_b", "ninef_b", "stingerg", "superd_b", "bullet_b", "ztype_b", "hotknife_b", "cogcabri", "surano_convertable", "rapidgt", "stingerg_b", "coquette_b", "bullet", "carbon", "ninef2", "carboniz", "cheetah", "adder_b", "entityxf", "adder", "feltzer", ], ]; foreach($vehicles as $category => $v_vals) { echo "vehicleSpawner " . $category . "[] = {\n"; foreach($textures as $k => $t_vals) { foreach (array_intersect($v_vals, $t_vals) as $match) { echo " { \"$match\", \"$k\", \"$match\" },\n"; } } echo "}\n"; }
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
vehicleSpawner vehicleSuper[] = { { "adder", "lgm_default", "adder" }, { "bullet", "lgm_default", "bullet" }, } vehicleSpawner vehicleSport[] = { }

preferences:
127.38 ms | 408 KiB | 5 Q