Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61442 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72930 invoked from network); 18 Jul 2012 21:39:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2012 21:39:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 74.125.82.54 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:61935] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/25-46800-42D27005 for ; Wed, 18 Jul 2012 17:39:49 -0400 Received: by wgx1 with SMTP id 1so1376134wgx.11 for ; Wed, 18 Jul 2012 14:39:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:from:to:cc:references:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :x-mailer:x-mimeole:x-gm-message-state; bh=qPLWwWnScw81yd1f/toc5jWYznvl91MqaqZyl3Lz9EA=; b=DhBzaWwRuv3fafcI8qoaCCrcDx8sg+RH4d2o5ARySOE5FzXEyvUvOfWbT3V3SQmNO7 ampsN/XMh8XG4pC8viAwIWcdaBdiLAGTaidrnp9UUWwRN0rFmNhokgNu+py51jeO9ssW itwfw6IwCEY4OUGHkVTdnCeGyZkarD6cAQgZRSrE1U17iEV/r0TrZu+i+zu41jOXPLtw Vvr8bkXltdCzSGt1ZZCIc8bdbRES9Zxy6DoVOQzTSwlUF7kHuB/wRt+oKAHgKI6mrxgM B0FZp81Ia51ubdfjmTRRxnzwsY2JT5RSa9yA9s6L73JcGfjp74f46Ufyq6/4Xpy+KFMz KTVw== Received: by 10.180.91.228 with SMTP id ch4mr10059654wib.7.1342647585916; Wed, 18 Jul 2012 14:39:45 -0700 (PDT) Received: from pc (95-42-82-194.btc-net.bg. [95.42.82.194]) by mx.google.com with ESMTPS id l3sm422237eep.3.2012.07.18.14.39.43 (version=SSLv3 cipher=OTHER); Wed, 18 Jul 2012 14:39:44 -0700 (PDT) Message-ID: To: "Galen Wright-Watson" , "Anthony Ferrara" Cc: "Rafael Dohms" , "PHP internals" References: Date: Thu, 19 Jul 2012 00:39:41 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Gm-Message-State: ALoCoQl9EcIhB6dZVs5j7WsYMbHXO9uLXRqEmLWm4q7mQHo5/1DGzB33YrC2r47Ww3089CW8tfoB Subject: Re: [PHP-DEV] Implicit isset in ternary operator From: sv_forums@fmethod.com ("Stan Vass") > It changes the semantics. If the variable is set to a falsey value and ?: > uses an implicit isset, the value of the expression will be the falsey > value. > > $config['width'] = '' > $width = $config['width'] ?: 300 > # $width == '' > > If !empty were used instead of isset, you could preserve semantics ($a ?: > dflt = !empty($a) ? $a : dflt). > Since this has been discussed before, here's a previous solution with zero of those problems: // A new operator. $width = $config['width'] ?? 300; // Actual behavior of the operator in pseudo code: $width = isset($config['width']) ? $config['width'] : 300; Why wasn't it implemented? No reason, it just wasn't. But people keep asking about it, so it's only a matter of time. Stan