Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61635 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22100 invoked from network); 23 Jul 2012 03:12:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2012 03:12:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=alex.aulbach@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alex.aulbach@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: alex.aulbach@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:42499] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/44-20357-511CC005 for ; Sun, 22 Jul 2012 23:12:22 -0400 Received: by pbbrp12 with SMTP id rp12so10906722pbb.29 for ; Sun, 22 Jul 2012 20:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=DeaVgLWiQkOImj9OKjAP8J+QHlQJtFSUf98LqFdKRKA=; b=A9xXket2Cw9r0VQF1z9TQ4zkTiSzvwC9rw2gticz3B2C7P8NBBYFMqy8G8SUhyR7+d tf8PJIy4AbZEVyIbDejuvwnVFmKY9cgYyb4GSCtTaMHbUxtQ0Gv77Ig8+c4rptxr7z/b udsweF+OrTdYV/eZMKqqfYh+WzAk2PoWmPm04Qnh5W2w2rU8wMcPvxETvthhi3WvTeak 9rrotsY4IwIf5RL5UD1uC/XoNfi3q8yk6DX0q142w0X4Ddo4IVMpLt7Ng0IPvfIW9Tb5 ZAvZAafqG2kop48BuFR0bigxEBWZl3Ruq53f7b9SHbSkmajN3H86eMqxE3a08QveyJtx ylAQ== MIME-Version: 1.0 Received: by 10.68.130.9 with SMTP id oa9mr31576597pbb.95.1343013139121; Sun, 22 Jul 2012 20:12:19 -0700 (PDT) Received: by 10.68.31.7 with HTTP; Sun, 22 Jul 2012 20:12:19 -0700 (PDT) In-Reply-To: References: Date: Mon, 23 Jul 2012 05:12:19 +0200 Message-ID: To: Rafael Dohms Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Implicit isset in ternary operator From: alex.aulbach@gmail.com (Alex Aulbach) Do we really need that as operator? Why not using new functions for special cases. Don't see much difference between $a = $b ?: $c; and (for example I used "i" for "if") $a = _i($b, $c); Just a manner of getting accustomed to it. A little bit more thinking: This could be implemented directly into any program/project, so it is a manner of how to use PHP and not of why it isn't added to the language. PS: Would it be possible to implement functions like ":?()" or "!?()" ? Currently this is not allowed by syntax. 2012/7/18 Rafael Dohms : > $width = $config['width'] ?: 300; > > The only reason for this to not work is: it throws a notice if the array > key is not there (which is the case we are covering anyway) > > This is basically because the ternary operator does not do a internal > implicit isset, only an empty. > > Does this seem like a possible improvement we can work on? Anyone > interested in championing the change? -- Alex Aulbach