Not having any luck with preg_match
im trying to parse a url for the last 2 / sections. i need to get the
address (can get that) and the number(second section
{ie:08078612,08248595} unless its at last and no address is present {last
url list example} {ie: 8274180}) i optionally need to get the last 3
digits of the second only numbers section.{ie 612,595,180}
Im not having any luck heres my code so far.
$url_list[] = $url;
if(preg_match("/[0-9]/",substr(strrchr($url, '/'), 1))) {
$url_list_mls[]= substr(strrchr($url, '/'), 2);
$url_list_mls_last3[] = substr(strrchr($url, '/'), -3);
} else {
$url_list_mls[]= substr(strrchr($url, '/'), 1);
$url_list_mls_last3[] = substr(strrchr($url, '/'), -3);
}
$url_list_addy[]= substr(strrchr($url, '/'), 1);
Example URLs (part of the full url endings as examples)
/a019/08078612/214-N-CREST-Avenue
/a019/08248595/111-N-Elroy-Avenue
/a019/8274180
im trying to make 3 lists, address (last section) number (second section)
and last 3 numbers of the second section number.
No comments:
Post a Comment