Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43387 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61733 invoked from network); 18 Mar 2009 09:20:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2009 09:20:44 -0000 Authentication-Results: pb1.pair.com header.from=lewiswright@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=lewiswright@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.172 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: lewiswright@gmail.com X-Host-Fingerprint: 209.85.220.172 mail-fx0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:42582] helo=mail-fx0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/27-41920-BECB0C94 for ; Wed, 18 Mar 2009 04:20:44 -0500 Received: by fxm20 with SMTP id 20so383629fxm.23 for ; Wed, 18 Mar 2009 02:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EATcruaESKa58Zp4OXguDsxpuwoigNw0+R1X6T1IX1w=; b=T3FcXWGEGQdRXH3byW1UYhoUm0IWahXXqSMutBjru7BBKO0UqZ1ScxKaZV5AUozJ9j hXIDusMqf6BRZatx763AWn4RCxhQKB2di5ftrZX8LqD7/r5C73GNiKCpDUgkErYVMU1z cLoOT53Ft1vyRD8SMj1I+oJ5tkbTKgRsSj4K4= 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:content-transfer-encoding; b=swwsGmyiQab9HB8ibNf9RKy97vaBCVKD52FiWwFuvo1aVapiFJt3O+tw2Zazd1BPww fHg/SRJToTX3zS1d0y5SStdodimG6ed2yh0CoDhlBrC/DIxaM64ynr3+x45u0lk4pcfz X2MRabmNetxe3ZRsZtJUNN4/JlrRCub+gmGj0= MIME-Version: 1.0 Received: by 10.204.119.71 with SMTP id y7mr355059bkq.24.1237368040747; Wed, 18 Mar 2009 02:20:40 -0700 (PDT) In-Reply-To: <2D571271-76C1-4EFE-BF56-02D23F75D3B9@macvicar.net> References: <10845a340903020821v718bc762g243864f7e098ee1c@mail.gmail.com> <49AC08EA.5000105@macvicar.net> <10845a340903020836u67ba1600qd4be7101f4256863@mail.gmail.com> <49AC0CB7.6@macvicar.net> <10845a340903100332v32aaa2bbs20316c2aea7738a5@mail.gmail.com> <8f5c52fe0903111225lbbfd07ek7f51c9f1f31877c0@mail.gmail.com> <2D571271-76C1-4EFE-BF56-02D23F75D3B9@macvicar.net> Date: Wed, 18 Mar 2009 09:20:40 +0000 Message-ID: To: Scott MacVicar Cc: =?ISO-8859-1?Q?Christopher_=D6stlund?= , PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Patch and test cases too for From: lewiswright@gmail.com (Lewis Wright) Exactly. In javascript terms, that is what you'd expect since: array(1=3D>'test') ..Isn't a valid array. 2009/3/17 Scott MacVicar : > On 11 Mar 2009, at 19:25, Christopher =D6stlund wrote: > >> I think this behavior is a bit odd too: >> >> php -r "echo json_encode(array(0=3D>'test'));" // ["test"] >> php -r "echo json_encode(array(1=3D>'test'));" // {"1":"test"} >> >> > > The reason for this is encoding looks to see if the array is sequentially > numbered from 0 to x, and if so its a compatible javascript array. If it > starts at any other value or skips a number then it creates an object for > its output. > > Scott > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >