Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87888 invoked from network); 18 Jul 2012 14:15:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2012 14:15:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=listas@rafaeldohms.com.br; spf=fail; sender-id=fail Authentication-Results: pb1.pair.com header.from=listas@rafaeldohms.com.br; sender-id=fail Received-SPF: fail (pb1.pair.com: domain rafaeldohms.com.br does not designate 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: listas@rafaeldohms.com.br X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:49384] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/E8-39169-315C6005 for ; Wed, 18 Jul 2012 10:15:48 -0400 Received: by vcbgb30 with SMTP id gb30so319588vcb.29 for ; Wed, 18 Jul 2012 07:15:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=ACFlewDYeEYoFmmP2jyKZCBOykn6KnIC+C9h9EScHrU=; b=MWhMi6adEf5co5wzNjRCtYhUwZ6KzAA6sDPOdM/OAWqgCz+qPJVenAO8noiN6YVliB fz+D65ZTejFxNMS5UqfilqnM+LZLQFF40NagdExrSq5Ep8qdYCtJVbHTCEg0KVlHwXwG iD1N5q+/E4XnmAbyKayYPAokQnya3qvYagjIICe+f1FJcKWB/ph0/8I0dLG0nkAl2uOv Nt2AHVhqU1cyKUiOsCRxZnzN1B+i8p0j+WqkQuiwMk113rnHrwJSZwWuCPcV6OY8Qftp +CiRNMO/TdEhtBcishySmFVW/U0eM80wX8pGKv71b50aOy4o1z4qKaMypYcelOqgd9Lh 615A== MIME-Version: 1.0 Received: by 10.221.12.195 with SMTP id pj3mr843871vcb.68.1342620945017; Wed, 18 Jul 2012 07:15:45 -0700 (PDT) Received: by 10.220.221.70 with HTTP; Wed, 18 Jul 2012 07:15:44 -0700 (PDT) Date: Wed, 18 Jul 2012 16:15:44 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=bcaec54eeffc7eea5304c51b4cb6 X-Gm-Message-State: ALoCoQkGc9dMDl4wq64OeC9FiZBrGGmwkAfTBQ/Yy5hN5g9FvDK2aXyAMVCdbVF/OHzw8Dahl3+m Subject: Implicit isset in ternary operator From: listas@rafaeldohms.com.br (Rafael Dohms) --bcaec54eeffc7eea5304c51b4cb6 Content-Type: text/plain; charset=ISO-8859-1 Hey Everyone, With the syntax improvements for 5.4 and some of the de-referencing work, code looks so much sleeker then before, but there is still one use case that really bugs me. Given this code: $width = (isset($config['width']))? $config['width'] : 300; The code is pretty straight forward, if width is set in the array, use it otherwise use 300. This code would look much better if it could make use of the ternary operator $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? -- Rafael Dohms PHP Evangelist and Community Leader http://www.rafaeldohms.com.br http://www.phpsp.org.br --bcaec54eeffc7eea5304c51b4cb6--