RE: help me split chars w/o spaces by 2... like: 2004

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <lmiranda@xxxxxxxxx>
Reply-To: Louie Miranda <lmiranda@xxxxxxxxx>
To: php-general@xxxxxxxxxxxxx
Subject: help me split chars w/o spaces by 2... like: 2004
Date: Thu, 9 Dec 2004 09:55:57 +0800
MIME-Version: 1.0
Received: from pb1.pair.com ([216.92.131.4]) by mc6-f24.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Dec 2004 17:56:52 -0800
Received: (qmail 21242 invoked by uid 1010); 9 Dec 2004 01:56:02 -0000
Received: (qmail 21150 invoked by uid 1010); 9 Dec 2004 01:56:01 -0000
X-Message-Info: 6sSXyD95QpUKIecQn+Z/xIP21pcg8LTu
Mailing-List: contact php-general-help@xxxxxxxxxxxxx; run by ezmlm
Precedence: bulk
list-help: <mailto:php-general-help@xxxxxxxxxxxxx>
list-unsubscribe: <mailto:php-general-unsubscribe@xxxxxxxxxxxxx>
list-post: <mailto:php-general@xxxxxxxxxxxxx>
Delivered-To: mailing list php-general@xxxxxxxxxxxxx
Delivered-To: ezmlm-scan-php-general@xxxxxxxxxxxxx
Delivered-To: ezmlm-php-general@xxxxxxxxxxxxx
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=gp2OcpYqK7wZkSMBhO5OvxdTzhTOQdM1+n9ZtLJ4lmsKWFpVRb9Y2kyjNIrRIX/rvXeFfwCVGh7LT6kub0DMmCGdeRiLKeCjJkxK4fWxSrP2D+FexciD2lT8ASKD7TNYC3YGIZLZbk5UEJIq9Yx2TkbIdgNd/Op3+iEviy1scI4=
Return-Path: php-general-return-203778-dbnm=hotmail.com@xxxxxxxxxxxxx
X-OriginalArrivalTime: 09 Dec 2004 01:56:53.0406 (UTC) FILETIME=[5AF313E0:01C4DD92]


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 code

But it splits the whole "2004" string..

Array
(
    [0] => 2
    [1] => 0
    [2] => 0
    [3] => 4
)


-- Louie Miranda http://www.axishift.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux