I did something like this a while back, I believe I used chunk_split
[code]
?
$year_split = date(Y);
$chars = chunk_split($year_split,2);
print_r($chars);
?
[/code]
it'll output something along the lines of:
20
04
Hope this helps,
--
have you tride using chop() ?
# begin code
$year_split = date(Y);
$chars = chop($year_split);
$chars[0] // = 2
$chars[1] // = 0
$chars[2] // = 0
$chars[3] //= 4
# end code
I hope that will help
From: Louie Miranda [EMAIL PROTECTED]
Reply-To: Louie Miranda [EMAIL PROTECTED]
To: [EMAIL
On Thu, 2004-12-09 at 09:55 +0800, Louie Miranda wrote:
Help me split chars w/o spaces by 2... like: 2004
How can i make it?
first: 20
second: 04
Im working on this..
# begin code
$year_split = date(Y);
$chars = preg_split('//', $year_split, -1, PREG_SPLIT_NO_EMPTY);
# end
?php
$hello2 = chop($year_split);
echo $hello2;
?
outputs: 2004
Whats the correct syntax for it? The manual said..
This function is an alias of rtrim().
and:
rtrim
(PHP 3, PHP 4 )
rtrim -- Strip whitespace from the end of a string
On Wed, 08 Dec 2004 18:11:19 -0800, Tyler Replogle
4 matches
Mail list logo