Re: question about explode()

From: Date: Fri, 28 Sep 2001 07:21:49 +0000
Subject: Re: question about explode()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69136@lists.php.net to get a copy of this message
> Woops: > so is there a syntactical way to tell explode to split at every > **THIRD** character? Nope. What is wrong with substr($fone,0,3) substr($fone,3,3) substr($fone,6,3) to get the 3 parts? This is the most efficient way. If you really want to do it in one line, you can do: preg_match('/(\d{3})(\d{3})(\d{3})/',$fone,$reg); At this point your parts are in $reg[1], $reg[2] and $reg[3]. But this approach is much slower than the simple substr() -Rasmus

« previous php.general (#69136) next »