3v4l.org

run code in 300+ PHP versions simultaneously
<?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";

preferences:
38.91 ms | 402 KiB | 5 Q