# Profiling include vs include_once

- Thread: https://externals.io/message/30398
- Original archive: https://news-web.php.net/php.internals/30398
- Started by Tomas Kuliavas on 2007-07-02T05:40:22+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #30398 — Tomas Kuliavas — 2007-07-02T05:40:22+00:00

URL: https://externals.io/message/30398#30398

Hi,

I've tried to profile scripts with Zend Profiler (Zend Studio 5.5 Linux
trial on local host + Zend Platform 3.0.2 Linux trial on remote vmware
host) and noticed that script with include() call has higher load time. I
have't found explanation of performance differences between include and
include_once in PHP manual. Maybe somebody could explain it.

sample files
--- test.php ---
<?php
/** profiled file */
include_once('./test2.php');
echo $test;
---

--- test2.php ---
<?php
/** included with include_once() */
$test = 'test';
/** lower load time if include() replaced with include_once() */
include('./test3.php');
---

--- test3.php ---
<?php
/** included with include()*/
---

In real scripts there are not functions in test2.php and test3.php.
test2.php is a configuration file with lots of string and array variables.
test3.php is a second configuration file and usually has only comment
section.

-- 
Tomas
