Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49862 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96538 invoked from network); 4 Oct 2010 09:29:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2010 09:29:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:47443] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/30-29533-06E99AC4 for ; Mon, 04 Oct 2010 05:29:05 -0400 Received: by wwb13 with SMTP id 13so152920wwb.11 for ; Mon, 04 Oct 2010 02:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=OFPZnIMZo7DKXCEAPUP9MV29xNxQ0AWnwJkVqJSMoZo=; b=WNrsgf1ZsGAlTak9m/0D1VHCqeWc5rIvAn7y1vzGC7qlqU3nE3jnD+sSII+DeM594E 6Zqk0ytvDnnAf6FnrVx6PzCXQpbd46rA5BgWTb8Jy7jAwL6TbflqbBqteZEip6dNMzJ8 peBf1KNjvgX2TsiIG+O69CuRl2jHCx0eX4zlI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=DnB7lByO6IFKMjfreXM+NoEr3BCeudMOZlKK//dznpc1wX/bOtKHub5JJN2FgVLIrD +FAh5waMJpZNCXKcvW2subAiduoGMyU9EadFEgn0k39gKZ930c2PXX7JyeDZ+LAWB0wO VHRTOqXE+0zpUIlYyVEj0GbF7CKAXgSW4WLDc= MIME-Version: 1.0 Received: by 10.227.135.211 with SMTP id o19mr7952572wbt.73.1286184540535; Mon, 04 Oct 2010 02:29:00 -0700 (PDT) Received: by 10.227.130.164 with HTTP; Mon, 4 Oct 2010 02:29:00 -0700 (PDT) In-Reply-To: References: <4CA6885F.3040709@sugarcrm.com> <4CA91151.2010104@sugarcrm.com> Date: Mon, 4 Oct 2010 11:29:00 +0200 Message-ID: To: Derick Rethans Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] rfc2616 datetime format? From: pierre.php@gmail.com (Pierre Joye) On Mon, Oct 4, 2010 at 10:42 AM, Derick Rethans wrote: > On Mon, 4 Oct 2010, Pierre Joye wrote: > >> On Mon, Oct 4, 2010 at 1:27 AM, Stas Malyshev wrote: >> > >> >> It looks like a sub optimal choice to have used string constants >> >> instead of integer. However it could be still possible to define new >> >> constants as numeric. It is then possible to do whatever needs to be >> >> done as post or pre ops for the respective constants. >> > >> > I'm not sure what integers have to do with it? The constants define date >> > formats that are in common use, RFC2616 is one of the commonest on the web >> > and we don't have a constant for it... >> >> I mean in ext/date and as a reply to Derick, not your request which is >> totally valid. A date time object has the timezone information. If the >> constants were integers, it would be very straightforward to do some >> operations before calling the formatting functions depending on a >> given predefined format. It should still be possible to do it by >> testing the string contents (strncmp), but that's not very clean. > > Stop talking about something you don't know anything about, please. > Those constants are not *one* format letter, they are many. Maybe you > could have tried this: > > echo DateTime::RFC822, "\n"; Maybe you could read what I wrote instead of replying in such stupid manner, that could lead the discussions in a constructive direction, thanks. Key parts were: 1. using integer makes such features easier to implement (basic good practice/programming 101) 2. use strncmp to compare the format (yes, strncmp supports many characters) 2. is bad as it has the side effects of applying to a format given manually even if one did not intend to use it this way, it could have BC issues but I'm not sure at all if such format exists. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org