Chaim
Chaim

Reputation: 2149

How can I skip execution of the parent of an included file (but not the parent's parent)

I have three files:

inner.php is included inside outer.php and innermost.php is further included inside inner.php

innermost.php has a condition in it that needs to stop execution of inner.php but not outer.php

Calling return will end execution of innermost.php but not inner.php

In other words, how can I skip execution from an included file of the immediate file it was included in.

Upvotes: 1

Views: 104

Answers (1)

Tom van der Woerdt
Tom van der Woerdt

Reputation: 29985

I suppose you could check the return value of innermost.php:

if ((include 'inermost.php') != true) {
    return false;
}

Do make sure to return true; in innermost.php

Upvotes: 2

Related Questions