3v4l.org

run code in 300+ PHP versions simultaneously
<?php const AMENITY_ICONS_TO_ADDON_CATEGORY = [ 'wellness' => ['fieldName' => 'wellness-use', 'type' => 'category'], 'wine-tasting' => ['fieldName' => 'Welcome Drink', 'type' => 'description'], 'full-board' => [ 'fieldName' => "3 Course Menu, 4 Course Menu", 'type' => 'description', 'terms' => true ], 'half-board' => ['fieldName' => 'halfboard', 'type' => 'category'], 'parking' => ['fieldName' => 'parking', 'type' => 'category'], ]; function getQueryDefinitionForInclusiveServices(string $term): array { $mapping = AMENITY_ICONS_TO_ADDON_CATEGORY[$term] ?? $term; $queryDefinition = []; $fieldName = 'included_amenities.descriptions.icon'; $term = $mapping['term'] ?? $term; if (is_array($mapping)) { $fieldName = $mapping['type'] == 'category' ? 'hotel.included_addons.category.keyword' : 'hotel.included_addons.en_GB.description.keyword'; if (!empty($mapping['terms'])) { $queryDefinition['type'] = 'terms'; } } $queryDefinition['field'] = $fieldName; $queryDefinition['term'] = $term; return [ $queryDefinition ]; } var_dump(getQueryDefinitionForInclusiveServices('full-board'));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0080.01019.53
8.5.20.0060.00417.98
8.5.10.0150.00416.56
8.5.00.0130.00716.56
8.4.180.0140.00919.77
8.4.170.0250.00819.78
8.4.160.0230.00920.63
8.4.150.0280.00919.74
8.4.140.0320.01117.80
8.4.130.0260.00617.58
8.4.120.0220.00817.68
8.4.110.0360.00917.89
8.4.100.0290.00917.61
8.4.90.0210.00517.70
8.4.80.0180.00317.46
8.4.70.0400.01117.57
8.4.60.0480.01017.66
8.4.50.0300.00917.71
8.4.40.0450.01017.68
8.4.30.0150.01017.34
8.4.20.0220.00917.66
8.4.10.0200.00517.71
8.3.300.0290.00718.31
8.3.290.0280.01218.22
8.3.280.0340.00918.31
8.3.270.0370.01216.39
8.3.260.0410.00816.55
8.3.250.0390.00516.69
8.3.240.0310.01216.59
8.3.230.0360.01016.57
8.3.220.0390.00816.45
8.3.210.0360.01116.41
8.3.200.0340.00916.40
8.3.190.0400.00516.49
8.3.180.0370.00816.53
8.3.170.0410.00916.64
8.3.160.0390.01016.43
8.3.150.0420.00616.32
8.3.140.0440.01016.51
8.3.130.0360.01016.65
8.3.120.0270.00916.53
8.3.110.0350.00916.58
8.3.100.0400.01016.84
8.3.90.0400.01116.54
8.3.80.0390.01016.55
8.3.70.0380.01216.44
8.3.60.0400.00516.40
8.3.50.0380.00916.90
8.3.40.0340.01017.80
8.3.30.0230.01217.95
8.3.20.0330.00917.72
8.3.10.0350.00917.79
8.3.00.0270.01017.85

preferences:
32.31 ms | 403 KiB | 5 Q