3v4l.org

run code in 300+ PHP versions simultaneously
<?php $order_wrapper = entity_metadata_wrapper('commerce_order', $commerce_order); $shipping = $order_wrapper->commerce_customer_shipping->commerce_customer_address->value(); $address1 = $shipping['thoroughfare']; $address2 = $shipping['premise']; $postal_code = $shipping['postal_code']; $country = $shipping['country']; $state = $shipping['administrative_area']; $military_states = array('AA', 'AE', 'AP'); $pattern = "/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i"; $match = array(); if preg_match($pattern, $address1) { $match[] = 1; } else { // Do nothing } if preg_match($pattern, $address2) { $match[] = 1; } else { // Do nothing } if preg_match($pattern, $postal_code) { $match[] = 1; } else { // Do nothing } if in_array($state, $military_states) { $match[] = 1; } else { // Do nothing } $total = array_sum_values($match); if ($total > 0) { return FALSE; } else { return TRUE; } ?>

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)
5.4.260.0030.03719.13
5.4.250.1100.03718.83
5.4.240.1830.03018.98
5.4.230.1930.04319.16
5.4.220.1500.03318.83
5.4.210.2070.04719.32
5.4.200.1630.03718.86
5.4.190.1600.04019.30
5.4.180.1730.03319.08
5.4.170.1900.03719.08
5.4.160.1730.04019.14
5.4.150.1870.03319.22
5.4.140.1300.04316.36
5.4.130.0030.03716.50
5.4.120.0100.02716.65
5.4.110.0270.02716.41
5.4.100.1570.03716.58
5.4.90.1570.03016.36
5.4.80.1800.03316.44
5.4.70.1930.03716.50
5.4.60.1800.03716.34
5.4.50.2100.04716.38
5.4.40.1970.04316.16
5.4.30.1800.03716.48
5.4.20.1770.03716.52
5.4.10.1830.03316.32
5.4.00.1870.03716.10
5.3.280.1830.04014.54
5.3.270.1830.03714.63
5.3.260.2070.05014.56
5.3.250.2070.04314.63
5.3.240.1900.04014.46
5.3.230.2200.04314.69
5.3.220.2070.05314.66
5.3.210.2030.04014.41
5.3.200.2170.04014.62
5.3.190.1900.04314.45
5.3.180.1830.03714.44
5.3.170.2000.03314.41
5.3.160.2500.04014.51
5.3.150.2300.03314.55
5.3.140.1830.03714.50
5.3.130.1100.04014.49
5.3.120.0100.07314.42
5.3.110.0030.06014.64
5.3.100.1370.03313.99
5.3.90.1730.04014.04
5.3.80.1730.04013.97
5.3.70.1870.02713.88
5.3.60.1800.03313.84
5.3.50.1800.03313.90
5.3.40.1730.04013.75
5.3.30.1770.03313.71
5.3.20.2100.04313.74
5.3.10.2030.04013.67
5.3.00.2030.03713.58
5.2.170.1530.03311.09
5.2.160.1500.03711.01
5.2.150.1430.03011.20
5.2.140.1670.03710.99
5.2.130.1400.03311.16
5.2.120.1500.02710.95
5.2.110.1470.02310.96
5.2.100.1800.02710.95
5.2.90.1430.03311.00
5.2.80.1630.03310.93
5.2.70.1570.02711.00
5.2.60.1500.02311.07
5.2.50.1700.03310.88
5.2.40.1100.03311.04
5.2.30.1430.03711.04
5.2.20.1170.02311.01
5.2.10.1300.03710.81
5.2.00.1070.03310.63
5.1.60.1170.0239.89
5.1.50.1230.02710.05
5.1.40.1300.0279.98
5.1.30.1230.02710.35
5.1.20.1200.02310.37
5.1.10.1330.03010.05
5.1.00.1400.0339.98
5.0.50.0630.0278.70
5.0.40.0770.0178.39
5.0.30.0630.0308.20
5.0.20.0630.0208.13
5.0.10.0770.0308.29
5.0.00.0770.0408.09
4.4.90.0730.0237.78
4.4.80.0730.0237.78
4.4.70.0630.0137.78
4.4.60.0630.0207.78
4.4.50.0570.0207.78
4.4.40.0670.0307.78
4.4.30.0730.0237.78
4.4.20.0730.0307.78
4.4.10.0800.0207.78
4.4.00.0700.0407.78
4.3.110.0630.0177.78
4.3.100.0600.0177.78
4.3.90.0770.0237.78
4.3.80.0770.0337.78
4.3.70.0530.0177.78
4.3.60.0500.0207.78
4.3.50.0670.0107.78
4.3.40.0630.0277.78
4.3.30.0330.0237.78
4.3.20.0270.0207.78
4.3.10.0270.0207.78
4.3.00.0330.0207.78

preferences:
142.26 ms | 1394 KiB | 7 Q