3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '~^(?<address>(?<streetname>\h*\S.*?)\h*(?<housenumber>\d+\h*[A-Za-z]?))(?:/(?<stairs>\d+)(?=(?:/\d+){1,2}))?(?:/(?<floor>\d)(?=(?:/\d+)))?(?:/(?<door>\d+))?$~m'; $strings = [ "Lilienstr. 12a", "Leibnizstraße 36/28/2", "Prager Straße 14/3/1/4", "Guentherstr. 43 B", "Eberhard-Leibnitz Str. 1/7", "Schießstätte 7/7" ]; foreach ($strings as $string) { preg_match_all($re, $string, $matches, PREG_SET_ORDER); $address = array_filter($matches[0], "is_string", ARRAY_FILTER_USE_KEY); print_r($address); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [address] => Lilienstr. 12a [streetname] => Lilienstr. [housenumber] => 12a ) Array ( [address] => Leibnizstraße 36 [streetname] => Leibnizstraße [housenumber] => 36 [stairs] => 28 [floor] => [door] => 2 ) Array ( [address] => Prager Straße 14 [streetname] => Prager Straße [housenumber] => 14 [stairs] => 3 [floor] => 1 [door] => 4 ) Array ( [address] => Guentherstr. 43 B [streetname] => Guentherstr. [housenumber] => 43 B ) Array ( [address] => Eberhard-Leibnitz Str. 1 [streetname] => Eberhard-Leibnitz Str. [housenumber] => 1 [stairs] => [floor] => [door] => 7 ) Array ( [address] => Schießstätte 7 [streetname] => Schießstätte [housenumber] => 7 [stairs] => [floor] => [door] => 7 )

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:
705.34 ms | 407 KiB | 5 Q