- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- array_pop: documentation ( source)
<?php
$address = '131st Avenue 131';
$matchArr = array();
preg_match_all('/(\d+)/', $address, $matchArr);
var_dump($matchArr);
$number = array_pop(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";