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, -- <<-------------------------------------------------------- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 ------------------------------------------------------->> On Thu, 9 Dec 2004 10:21:49 +0800, Louie Miranda <[EMAIL PROTECTED]> wrote: > <?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 <[EMAIL PROTECTED]> wrote: > > 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 PROTECTED] > > >Subject: [PHP] 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 [EMAIL PROTECTED]; run by ezmlm > > >Precedence: bulk > > >list-help: <mailto:[EMAIL PROTECTED]> > > >list-unsubscribe: <mailto:[EMAIL PROTECTED]> > > >list-post: <mailto:[EMAIL PROTECTED]> > > >Delivered-To: mailing list [EMAIL PROTECTED] > > >Delivered-To: [EMAIL PROTECTED] > > >Delivered-To: [EMAIL PROTECTED] > > >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: [EMAIL PROTECTED] > > >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 > > > > > > > > > -- > Louie Miranda > http://www.axishift.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- <<-------------------------------------------------------- Jasper Howard - Database Administration ApexEleven.com 530 559 0107 ------------------------------------------------------->> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php