4번독수리의 둥지
PHP define 본문
on PHP 5.1.6
1.
define(FOO, 'bar');
echo FOO;
--------
bar
2.
function foo() {
define(BAR, 'baz');
}
foo();
echo BAR;
--------
baz
3.
$foo = 'bar';
define(BAZ, $foo);
unset($foo);
echo $foo;
echo '--';
echo BAZ;
--------
--bar
4.
class Foo
{
public function __construct()
{
self::bar();
}
public static function bar()
{
define(BAZ, 'quux');
}
}
$norf = new Foo();
echo BAZ;
--------
quux
5.
define(FOO, 'bar');
define(FOO, 'baz');
echo FOO;
--------
bar
'PHP' 카테고리의 다른 글
generating pagination in PHP (0) | 2016.02.22 |
---|---|
All PHP functions have the global scope (0) | 2015.12.03 |
PHP memory management (0) | 2015.11.30 |
Downgrading a PECL Module (0) | 2015.11.02 |
check max get parameter length with PHP+cURL (0) | 2015.10.20 |