Re: help me split chars w/o spaces by 2... like: 2004
| From: | Louie Miranda | Date: | Thu, 09 Dec 2004 02:21:49 +0000 |
| Subject: | Re: help me split chars w/o spaces by 2... like: 2004 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203783@lists.php.net to get a copy of this message | ||
<?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 <dbnm@hotmail.com> 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 <lmiranda@gmail.com>
> >Reply-To: Louie Miranda <lmiranda@gmail.com>
> >To: php-general@lists.php.net
> >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 php-general-help@lists.php.net; run by ezmlm
> >Precedence: bulk
> >list-help: <mailto:php-general-help@lists.php.net>
> >list-unsubscribe: <ïοB"øÈÅ«Õà<
> >jÖmailto:php-general-unsubscribe@lists.php.net>
> >list-post: <mailto:php-general@lists.php.net>
> >Delivered-To: mailing list php-general@lists.php.net
> >Delivered-To: ezmlm-scan-php-general@lists.php.net
> >Delivered-To: ezmlm-php-general@lists.php.net
> >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@lists.php.net
> >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