Posted by & filed under PHP, Programming.

Sometimes it is useful to know if a page has been included by another page or not, and then take action based on the result. A quick and handy way to accomplish this is to use a tenary operator to do something like:

Which will return true if it is included, and false if it is running as itself. Now, we are able to do something like:

Leave a Reply

You must be logged in to post a comment.