Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1772 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15293 invoked from network); 20 May 2003 08:40:14 -0000 Received: from unknown (HELO smtp-out.quicknet.nl) (213.73.255.38) by pb1.pair.com with SMTP; 20 May 2003 08:40:14 -0000 Received: from sleepert (qn-213-73-140-252.quicknet.nl [213.73.140.252]) by mta1.priv.quicknet.nl (iPlanet Messaging Server 5.2 HotFix 1.07 (built Nov 25 2002)) with SMTP id <0HF60036XG32ZV@mta1.priv.quicknet.nl> for internals@lists.php.net; Tue, 20 May 2003 10:40:14 +0200 (MEST) Date: Tue, 20 May 2003 10:40:15 +0200 To: internals@lists.php.net Message-ID: <001801c31eab$6fb77200$0200a8c0@sleepert> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Mailer: Microsoft Outlook Express 6.00.2800.1158 Content-type: multipart/alternative; boundary="Boundary_(ID_sCxneo8ymGH409LgchQK8Q)" X-Priority: 3 X-MSMail-priority: Normal Subject: Array keys expected behaviour? From: arjenip@wanadoo.nl (Arjen Brouwer) --Boundary_(ID_sCxneo8ymGH409LgchQK8Q) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Hi, Take the following code: "Porsche" ,"color" => black ); function nvl(&$var, $default = false) { return (isset($var)) ? $var : $default; } echo "Color: " . nvl($car["color"]) . "\n"; echo "Spoiler: " . nvl($car["spoiler"], "yes"); echo "\n\n"; print_r($car); ?> Output: --- Color: black Spoiler: yes Array ( [brand] => Porsche [color] => black [spoiler] => ) ---Look at the output of the last print_r, the key "spoiler" is defined? But is never defined in the code ...Just wondering, is this the expected behaviour?Running PHP4.3.2RC3Cheers, Arjen --Boundary_(ID_sCxneo8ymGH409LgchQK8Q)--