Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49863 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32723 invoked from network); 4 Oct 2010 11:18:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2010 11:18:02 -0000 Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:45855] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/D7-29533-9E7B9AC4 for ; Mon, 04 Oct 2010 07:18:02 -0400 Received: by qyk34 with SMTP id 34so916353qyk.8 for ; Mon, 04 Oct 2010 04:17:59 -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=L5nBuQQrxxpbsVyrz2yjLhBHXgZD5setx3CUXFBDHe8=; b=fA1uwNzVRYh2qoGY2q6JUSmnRfO6D/lB+ISqu8DrasnM40c5oD/zFcWa2h3OB2wWPF 1jFF7q+3ShWkzYgu4ajBc/OKFxqigCpvLEqcmIHiTMBHhNqrVtNmj77eKAI3Nh2gmdD7 vRSFPmoASl6Qv48P49Fu9/Cwk+6CbdTs0Gixs= 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=GbGHRmF8vhVo77lad25EK2QNJsFmvLq+xQEaTIqMGIP3f/t8sFB9g8xKAHLGWyJgnr /WyafutNujNhsSP8lm7L9bk+AWGi+3AvvILYlo/+z3fP0bdERIbtye/3gZ0UIWx0ayin yhtXn0lIFH4zjuH5AB8eD5Um0wHa62nnk1wn8= MIME-Version: 1.0 Received: by 10.229.213.200 with SMTP id gx8mr6922051qcb.89.1286191079458; Mon, 04 Oct 2010 04:17:59 -0700 (PDT) Received: by 10.229.241.2 with HTTP; Mon, 4 Oct 2010 04:17:59 -0700 (PDT) In-Reply-To: References: <4CA6885F.3040709@sugarcrm.com> <4CA91151.2010104@sugarcrm.com> Date: Mon, 4 Oct 2010 13:17:59 +0200 Message-ID: To: Pierre Joye Cc: Derick Rethans , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] rfc2616 datetime format? From: hannes.magnusson@gmail.com (Hannes Magnusson) On Mon, Oct 4, 2010 at 11:29, Pierre Joye wrote: > 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) Are you proposing that the constants become integers? so, DATE_RFC_1234 will be equal to "1234"? And then date(DATE_RFC_1234); will print out formatted string? I am afraid that would break craploads of applications, and become very confusing. -Hannes