Re: Re: com php-src: Mark "top-level" functions.: Zend/zend_compile.c Zend/zend_compile.h
| From: | Sara Golemon | Date: | Fri, 19 Oct 2018 15:14:42 +0000 |
| Subject: | Re: Re: com php-src: Mark "top-level" functions.: Zend/zend_compile.c Zend/zend_compile.h | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103340@lists.php.net to get a copy of this message | ||
On Fri, Oct 19, 2018 at 9:45 AM Sebastian Bergmann <sebastian@php.net> wrote:
>
> Am 19.10.2018 um 12:22 schrieb Dmitry Stogov:
> > Mark "top-level" functions.
>
> What are top-level classes or functions? Thanks!
>
Simple version; It's one that's declared unconditionally.
<?php
// Top-level is here
function topLevelFoo() {}
class topLevelBar() {}
if (cond()) {
// No longer top-level
function conditionalFoo() {}
class conditionalBar() {}
}
The longer answer is that it's not just conditionals that can make a
function/class "non-top-level", for example a namespace block makes
its declarations "non-top-level" but I suspect Dmitry will probably
address those in time.
-Sara