티스토리 뷰

Defines a named constant


bool   define  (  string   $name ,   mixed    $value    [  ,   bool    $case_insensitive    =    false   ]   )
Defines a named constant at runtime.

*Parameters

-name: the name of the constant.


-value: The value of the constant; only scalar and null values are allowed. Scalar values are integer, float, string or boolean values.


-case_insensitive: If set to true, the constant will be defined case_insensitive. The default behavior is case-sensitive; i.e. CONSTANT and Constant represent different values.

 

*Return value

-When it succeed, return true. On the contrary, return false.


Example:


<?php

define("CONSTANT", "Hello world.");

echo CONSTANT; // "Hello world."

echo Constant; // just output "Constant" with noticing issues.


define("GREETING", "Hello you.", true);

echo GREETING; // outputs "Hello you."

echo Greeting; //  outputs "Hello you."

?>



'Server Side > PHP' 카테고리의 다른 글

[PHP] print (String Function)  (0) 2015.07.31
[PHP] echo (String Function)  (0) 2015.07.31
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함