Re: Best way to split a string of numbers into segments.
| From: | Tom | Date: | Tue, 02 Dec 2003 14:22:04 +0000 |
| Subject: | Re: Best way to split a string of numbers into segments. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171579@lists.php.net to get a copy of this message | ||
David Otton wrote:
On Tue, 02 Dec 2003 13:14:20 +0000, you wrote:Yes, list() was, initially, my starting point. But preg_split() will not allow me split with the full /(\d{4})(\d{2})(\d{2})/ syntax (and assign the temp vars to thos in list(). Unless I missed something? $date=20031202; list ($a, $b, $c) = preg_split (/(\d{4})(\d{2})(\d{2})/);Is there an easy, non expensive way to do the perl-equivalent of: $date=20031202; ($year, $month, $day) = ($date =~ /(\d{4})(\d{2})(\d{2})/; I looked through the preg_* functions online, but couldn't see anything to help me. Am I stuck with substr() :P ?list() springs to mind list ($a, $b, $c) = preg_split (/* mumble mumble */); Hi David.
parse error, unexpected '/', expecting ')'