Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Created January 3, 2012 12:16
Show Gist options
  • Save meeDamian/1554720 to your computer and use it in GitHub Desktop.
Save meeDamian/1554720 to your computer and use it in GitHub Desktop.
[ PHP | stupidfix ] Stupid includes

Crazy includes

If you try to do something only if some include is loaded successfully you may try to do:

if(@include('some/file.inc')) { do_sth(); }

and it will most likely work, but sometimes you want to add extra parameter to this like this:

if(@include('some/file.inc') and $feature_enabled) { do_sth(); }

and in this case it will fail spectacularly. The fix to this is quite simple, but took me lots of time to find:

if((@include('some/file.inc')) and $feature_enabled) { do_sth(); } // Ya, faken (parentheses) ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment