Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61004 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30624 invoked from network); 27 Jun 2012 17:06:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2012 17:06:30 -0000 Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bk0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:50862] helo=mail-bk0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/51-22531-59D3BEF4 for ; Wed, 27 Jun 2012 13:06:30 -0400 Received: by bkcje2 with SMTP id je2so637526bkc.29 for ; Wed, 27 Jun 2012 10:06:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=fCqVBRCH4EEIwHkztUfjocvkXNf/TJE6W2Ly5qNQhkU=; b=JxEfbzGXle9xpujbIx5If8orGlHfP+phwbXNNa1/9m+7VwGa7+Iev2jvcyuZg41c0C tGAIDfTcLLNx6znKy1XiPrG3uNN19fgECbA7EmvFexiPDl82TEG9TkxkfD4zDIPVW3C/ uwPgk7KlmQgUwFTFnsBnWxC+smirBkdqmRreKhIFxDTt5ElPiVyy3J2ac97n8P1lwQTk YGAKQssZWpsq9ryopRj25hDGCXP4KF/z56LJPAFN28e4p4UbrwgAYTLONwLstU/PNVK6 qDk3jO9dPAbalH4TX9d3w/KkPz24JX465BGRy89jgT+aEUNe5SsfPD3Wj//Spjclwlwt nDjg== MIME-Version: 1.0 Received: by 10.152.104.171 with SMTP id gf11mr21577613lab.5.1340816785931; Wed, 27 Jun 2012 10:06:25 -0700 (PDT) Received: by 10.114.24.230 with HTTP; Wed, 27 Jun 2012 10:06:25 -0700 (PDT) Date: Wed, 27 Jun 2012 13:06:25 -0400 Message-ID: To: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Subject: [PHP-DEV] Braceless Syntax extended to functions and classes (bugs #47416 and 24100) From: dmgx.michael@gmail.com (Michael Morris) PHP has a braceless syntax stretching back to its roots as a template language. Frameworks which make use of php templating use these tags quite frequently since it's harder to overlook an endif statement in a sea of HTML tags than a brace. But what of endfunction? I did some look ups and found in the archive two of the most unhelpful - bordering on rude - comments I've seen on the bug database. [2003-06-09 13:40 UTC] derick@php.net > The "endif;" stuff is old legacy syntax and is definitely not the recommended way of doing things. For my part if can be removed for PHP 5... anyway, definitely not something we will add. [2009-02-17 15:41 UTC] johannes@php.net > Derick'S response to #24100 is still valid. We still prefer the {} syntax. So sure "we" (whoever we is) prefer braces. I prefer them in straight code contexts - I don't want to work with them in HTML templates. This said, the need to do a function or class closure inside a template is rare, bordering on non-existent. But for functions there is one case - anonymous functions - specifically for recursion. Here's a live example that renders a nested list.
  • 0): echo $render( $category['children'] ); endif ?>
This would be ever so slightly easier to read with endfunction.
  • 0): echo $render( $category['children'] ); endif ?>
I'm not going to raise too much of a fuss over it. At the end of the day, it's a small change. But the elitist, dismissive comments to the idea from the team at the time were unwarranted. Also, I have to wonder if the position on this has changed any at all? Particularly since