Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
computers:php_include_or_require [2009/02/16 21:02]
daniel
computers:php_include_or_require [2015/03/24 05:42] (current)
Line 51: Line 51:
  
 In mission critical apps, you should not use require or require_once because they will cause a fatal error and halt the php script regardless of the '​@'​ sign.  The '​@'​ sign just means "​don'​t show/echo the errors"​ but the errors happen anyway. In mission critical apps, you should not use require or require_once because they will cause a fatal error and halt the php script regardless of the '​@'​ sign.  The '​@'​ sign just means "​don'​t show/echo the errors"​ but the errors happen anyway.
 +
  
  
Line 60: Line 61:
   * **Begin with ''<?​php''​ **:  Always put the start/​opening php tab ''<?​php''​ as the first characters of the file/​line. ​ Otherwise it will give you headaches unimaginable,​ and waste days of your time.  This is particularly important for configuration files.   * **Begin with ''<?​php''​ **:  Always put the start/​opening php tab ''<?​php''​ as the first characters of the file/​line. ​ Otherwise it will give you headaches unimaginable,​ and waste days of your time.  This is particularly important for configuration files.
   * **Skip ''?>''​ : **Don'​t put the ending/​closing php tag ''?>''​ at the end of the include/​require files unless you want to break out of php and tell the parser to output results. ​ This is particularly important for configuration files.   * **Skip ''?>''​ : **Don'​t put the ending/​closing php tag ''?>''​ at the end of the include/​require files unless you want to break out of php and tell the parser to output results. ​ This is particularly important for configuration files.
-  * **Within ''​function''​ scope, be careful with ''​include_once''​ or ''​require_once''​ : **When inside a function, all variables are limited within the function scope, ​but require_once and include_once will not include the  desired file if it has been included/​required in/out of the function.+  * **Within ''​function''​ scope, be careful with ''​include_once''​ or ''​require_once''​ : **When inside a function, all variables are limited within the function scope, ​and require_once and include_once will not include the desired file if it has been included/​required in/out of the function.