php - Performance of $_SERVER['DOCUMENT_ROOT'], or define("SITE_ROOT", ""]); -
i need store document root used across application
i have 2 options, please mind explaining quicker , why? or indeed if there better way achieve this.
define("site_root", "/"]); $_server['document_root']."/path/to/file" so include created as;
require(site_root.'/path/to/file'); require($_server['document_root']."/path/to/file");
to use:
define("site_root", "/"); //typo removed is little little bit faster than:
$_server['document_root'] . "/path/to/file" since concatenate something, constant bit faster. think falls under micro management , don't think biggest performance issue in code.
even if "biggest performance issue", difference small can decide, want use , think more readable.
Comments
Post a Comment