Re: Need some coding help
| From: | Matt Waggoner | Date: | Sun, 15 Oct 2000 03:13:55 +0000 |
| Subject: | Re: Need some coding help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20198@lists.php.net to get a copy of this message | ||
There's a variety of ways. If you know the exact format the string will be
in, then you can do something like this:
<?
$str = "(415) 333-1234";
$strnew = substr($str, 1, 3) . substr($str, 6, 3) . substr($str, 10, 4);
?>
There are of course other ways to do it, but this seems simplest if you are
sure that the string will always be in the same format.
| Matt Waggoner - mattw@getacard.com
| Software Engineer, Getacard.com, Inc.
----- Original Message -----
From: Todd Cary <todd@aristesoftware.com>
To: <php-general@lists.php.net>
Sent: Saturday, October 14, 2000 20:03
Subject: [PHP] Need some coding help
> I do not have a Perl background, so properly manipulating strings is not
> my forte. I need to take a string like "(415) 333-1234" and convert it
> to "4153331234". How is this bes done with PHP?
>
> Many thanks......
>
> Todd
>
> --
> Todd Cary
> Ariste Software
> todd@aristesoftware.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net