3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @xmlNamespace http://www.webservices.nl/soap/ * @xmlType * @xmlName RiskAddress */ class Address { /** * @xmlType string * @xmlRender value * @xmlName postcode * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_postcode; /** * @xmlType string * @xmlRender value * @xmlName building * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_building; /** * @xmlType string * @xmlRender value * @xmlName street * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_street; /** * @xmlType integer * @xmlRender value * @xmlName house_number * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_house_number; /** * @xmlType string * @xmlRender value * @xmlName house_number_addition * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_house_number_addition; /** * @xmlType string * @xmlRender value * @xmlName city * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_city; /** * @xmlType string * @xmlRender value * @xmlName municipality * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_municipality; /** * @xmlType string * @xmlRender value * @xmlName state * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_state; /** * @xmlType string * @xmlRender value * @xmlName country * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_country; /** * @return string */ public function getPostcode() { return $this->_postcode; } /** * @param string $postcode */ public function setPostcode($postcode) { $this->_postcode = (string) $postcode; } /** * @return string */ public function getBuilding() { return $this->_building; } /** * @param string $building */ public function setBuilding($building) { $this->_building = (string) $building; } /** * @return string */ public function getStreet() { return $this->_street; } /** * @param string $street */ public function setStreet($street) { $this->_street = (string) $street; } /** * @return integer */ public function getHouseNumber() { return $this->_house_number; } /** * @param (integer) $houseNumber */ public function setHouseNumber($houseNumber) { $this->_house_number = (integer) $houseNumber; } /** * @return string */ public function getHouseNumberAddition() { return $this->_house_number_addition; } /** * @param string $houseNumberAddition */ public function setHouseNumberAddition($houseNumberAddition) { $this->_house_number_addition = (string) $houseNumberAddition; } /** * @return string */ public function getCity() { return $this->_city; } /** * @param string $city */ public function setCity($city) { $this->_city = (string) $city; } /** * @return string */ public function getMunicipality() { return $this->_municipality; } /** * @param string $municipality */ public function setMunicipality($municipality) { $this->_municipality = $municipality; } /** * @return string */ public function getState() { return $this->_state; } /** * @param string $state */ public function setState($state) { $this->_state = (string) $state; } /** * @return string */ public function getCountry() { return $this->_country; } /** * @param string $country */ public function setCountry($country) { $this->_country = (string) $country; } } class AddressHelper { public static function parse(Address $address, $parts) { $parts = func_get_args(); $address = array_shift($parts); $format = '~^(.*?\n)??' . '(?<street>[^0-9].*|.*?[^0-9])[\b\s]*?' . '(?<number>[0-9]{1,5}?)[\b\s\-]*?' . '(?<addition>[^\s]*?)[\b\s,]*?' . '(?<postcode>[0-9]{4}\s?[A-Z]{2})[\b\s,]*?' . '(?<city>[\w][\w\s]*?)' . '(\n.*)??$~msiU'; if (preg_match($format, implode(PHP_EOL, $parts), $args)) { $street = $number = $postcode = $city = $addition = null; extract($args, EXTR_OVERWRITE); $address->setStreet($street); $address->setHouseNumber($number); $address->setHouseNumberAddition($addition); $address->setPostcode($postcode); $address->setCity(strtoupper(trim($city))); } return $address; } } AddressHelper::parse(new Address(), 'van der pekstraat', '5064EA', null, null, null);
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.94 ms | 401 KiB | 8 Q