Reputation: 638
i have 2 pages their heads are like this
header:
<?php require_once "database.php"; ?>
page:
<?php require_once "database.php";
//some codes;
require_once "header.php"; ?>
I had to require database again for a script to collect data correctly for a specific page, Would that affect the page performance? Or the _once
fixes that?
Upvotes: 1
Views: 30
Reputation:
Based on PHP documentation if you had used required_once
for a file then it will not be required again. If there is a cost on performance? NO.
The require_once statement is identical to require except PHP will check if the file has already been included, and if so, not include (require) it again.
Upvotes: 2