3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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; } ?>
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected 'preg_match' (T_STRING), expecting '(' in /in/WlLp6 on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting '(' in /in/WlLp6 on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING, expecting '(' in /in/WlLp6 on line 16
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/WlLp6 on line 16
Process exited with code 255.