Skip to content

Instantly share code, notes, and snippets.

@jonathandavis
Created May 29, 2013 14:13
Show Gist options
  • Select an option

  • Save jonathandavis/5670561 to your computer and use it in GitHub Desktop.

Select an option

Save jonathandavis/5670561 to your computer and use it in GitHub Desktop.
<?php
$address = '125-S Main St';
$number = ''; $firstword = ''; $count = 1;
sscanf($address, '%d-%s', $number, $firstword);
if ( ! empty($number) && ! empty($firstword) )
$address = str_replace('-', '', $address, $count);
echo $address;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment