Profiling include vs include_once

From: Date: Mon, 02 Jul 2007 05:40:22 +0000
Subject: Profiling include vs include_once
Groups: php.internals 
Request: Send a blank email to internals+get-30398@lists.php.net to get a copy of this message
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

« previous php.internals (#30398) next »