3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $address = '5e Dorpsstraat 41B'; $matchArr = array(); preg_match('/(\d+?)/', $address, $matchArr); var_dump($matchArr); $number = array_pop($matchArr); $split = explode($number, $address); $lastPart = $number . array_pop($split); $firstPart = implode($number, $split); print 'First part: ' . $firstPart . "\n"; print 'Last part: ' . $lastPart . "\n";
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> string(1) "5" [1]=> string(1) "5" } First part: Last part: 5e Dorpsstraat 41B