Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70845 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76941 invoked from network); 23 Dec 2013 01:55:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2013 01:55:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.52 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.212.52 mail-vb0-f52.google.com Received: from [209.85.212.52] ([209.85.212.52:53096] helo=mail-vb0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/60-08405-AF797B25 for ; Sun, 22 Dec 2013 20:55:07 -0500 Received: by mail-vb0-f52.google.com with SMTP id p5so2446710vbn.25 for ; Sun, 22 Dec 2013 17:55:03 -0800 (PST) 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=t/z2j1T+EyLZNsvYBAkrinDHlGlZA5Ms+aTIne1zDYo=; b=ahe4Iz12TlTjkbMiqHo2bLcQf8hTU4BJk4I/QNzD8jvcVo/NRfBpbqadLopm15qMyE wQYiRh4XDYoBX5QhZi0zq4aYgfLEVv8YzzfwVnqz8ZaRe7Ot/owmXjNXi2Q7h0AypLCl /nVmTs6GyBfQla/++8SmMPDga1Aqmlw32mPcDLJRk6KdZ9B9ZMWa7MZ+714PxVsWFaR7 SfFoFLJrJ1CKO/APjJlPYyYby3rq8X4Ap3eV2SsUD0kQ2cE5PMS7mjxNl/gN7P1ePdoU oizcPHgXSzYCbF4GQR8bObYATyv2gV5QR/oz8W4U4jvG62z5p35DS2EnhW/54Rbbi4Jc pxSA== MIME-Version: 1.0 X-Received: by 10.221.47.193 with SMTP id ut1mr11328102vcb.8.1387763703844; Sun, 22 Dec 2013 17:55:03 -0800 (PST) Received: by 10.58.128.33 with HTTP; Sun, 22 Dec 2013 17:55:03 -0800 (PST) In-Reply-To: <385D731E-A068-4004-9A73-CC90050E1676@googlemail.com> References: <385D731E-A068-4004-9A73-CC90050E1676@googlemail.com> Date: Mon, 23 Dec 2013 09:55:03 +0800 Message-ID: To: Kevin Ingwersen Cc: php-dev Content-Type: multipart/alternative; boundary=001a113392ec999a2d04ee29ea40 Subject: Re: [PHP-DEV] Why is require still a function? From: tjerk.meesters@gmail.com (Tjerk Meesters) --001a113392ec999a2d04ee29ea40 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, On Mon, Dec 23, 2013 at 8:28 AM, Kevin Ingwersen wrote: > Hello there. > > I have seen an implementation of nodejs=92 require function - but it need= ed > to use a variable-function ($require(string $name)) instead, because > =82require()=91 is given. > > My questions are: > - Why is require still also available as a function? > - Why can=92t re re-define something like that? > This is because `require` is not a function but a language construct; the token is defined in the language parser definition: http://lxr.php.net/xref/PHP_5_6/Zend/zend_language_parser.y#62 Because of this, `require` is a reserved word unless exceptions are made in the parser itself, so `class require` and `function require()`, even when defined inside your own namespace will cause a parse error. > > Kind regards, and thanks! ^^ > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 -- Tjerk --001a113392ec999a2d04ee29ea40--