<?php
echo "Echo BLOG<br/>";
require(dirname(__FILE__) . "/constants.php");
echo "after loading constants...<br/>BLOG: " . BLOG . "<br/>";
echo "Load again <br/>";
require(dirname(__FILE__) . "/constants.php");
echo "Load again using require_once <br/>";
require_once(dirname(__FILE__) . "/constants.php");
?>
Output:
Echo BLOG
Define constants:
php cookbook
Constant ARTICLE_NAME not defined, define now
Constant ARTICLE_NAME defined
after loading constants...
BLOG: php cookbook
Load again
Define constants:
Notice: Constant BLOG already defined in C:\phpProjects\examples\constants.php on line 3
php cookbook
Load again using require_once
No comments:
Post a Comment