1.2.1641. include_once() Usage¶
This rules reports sage of
include_once()andrequire_once(). Those functions should be avoided for performances reasons.
Try using autoload for loading classes, or use include() or require() and make it possible to include several times the same file without errors.
<?php
// Including a library.
include 'lib/helpers.inc';
// Including a library, and avoiding double inclusion
include_once 'lib/helpers.inc';
?>
1.2.1641.1. Connex PHP features¶
1.2.1641.1.1. Suggestions¶
Avoid using include_once() whenever possible
Use autoload() to load classes, and avoid loading them with include
1.2.1641.1.2. Specs¶
Short name |
Structures/OnceUsage |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Examples |
|
Available in |