DEFINE(3) 1 DEFINE(3)define - Defines a named constantSYNOPSIS
bool define (string $name, mixed $value, [bool $case_insensitive = false])
DESCRIPTION
Defines a named constant at runtime.
PARAMETERS
o $name
- The name of the constant.
o $value
- The value of the constant; only scalar and null values are allowed. As of PHP 7 it also possible to use array value. Scalar val-
ues are integer, float, string or boolean values. It is possible to define resource constants, however it is not recommended and
may cause unpredictable behavior.
o $case_insensitive
- If set to TRUE, the constant will be defined case-insensitive. The default behavior is case-sensitive; i.e. CONSTANT and Con-
stant represent different values.
Note
Case-insensitive constants are stored as lower-case.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
CHANGELOG
+--------+---------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------+
| 7.0.0 | |
| | |
| | |
| | array values are allowed. |
| | |
+--------+---------------------------+
EXAMPLES
Example #1
Defining Constants
<?php
define("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world."
echo Constant; // outputs "Constant" and issues a notice.
define("GREETING", "Hello you.", true);
echo GREETING; // outputs "Hello you."
echo Greeting; // outputs "Hello you."
// Works as of PHP 7
define('ANIMALS', array(
'dog',
'cat',
'bird'
));
echo ANIMALS[1]; // outputs "cat"
?>
SEE ALSO defined(3), constant(3), The section on Constants.
PHP Documentation Group DEFINE(3)
Check Out this Related Man Page
APC_LOAD_CONSTANTS(3) 1 APC_LOAD_CONSTANTS(3)apc_load_constants - Loads a set of constants from the cacheSYNOPSIS
bool apc_load_constants (string $key, [bool $case_sensitive = true])
DESCRIPTION
Loads a set of constants from the cache.
PARAMETERS
o $key
- The name of the constant set (that was stored with apc_define_constants(3)) to be retrieved.
o $case_sensitive
- The default behaviour for constants is to be declared case-sensitive; i.e. CONSTANT and Constant represent different values. If
this parameter evaluates to FALSE the constants will be declared as case-insensitive symbols.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
apc_load_constants(3) example
<?php
$constants = array(
'ONE' => 1,
'TWO' => 2,
'THREE' => 3,
);
apc_define_constants('numbers', $constants);
apc_load_constants('numbers');
echo ONE, TWO, THREE;
?>
The above example will output:
123
SEE ALSO apc_define_constants(3), define(3), constant(3), Or the PHP constants reference.
PHP Documentation Group APC_LOAD_CONSTANTS(3)
Hi
I need help i Loop format
If i use the Following syntax
$ for i in `echo "Hello world"`
do
echo $i
done
Output is:
Hello
world
But i need Output in One line "Hello world"
Can any one help?
If i use while loop it works? (6 Replies)
hello
How can I go out to a "case" boucle, but not finish the program :
echo " your choice :"
read grp1
do
case ${grp1} in
1)grp1="toto1";;
2)grp1="toto2";;
3)grp1="toto3";;
4)grp1="toto4";;
5)grp1=t;;
6)grp1=t;;
... (3 Replies)
Here is the file named tuwork..........
209 200 WZ 6529 SKTNCA01X4X C POI LODI LODI 738 SKTNCA0127T LOD
Here is the scipt.......
cat tuwork |
while
read rva
do
num=`echo $rva | cut -d" " -f1-2`
reg=`echo $rva | cut -c10`
ocn=`echo $rva | cut -c12-15`
x=`echo $rva | cut -c29`... (3 Replies)
I'm not sure how to best explain what I'd like to do, so let me give an example. I used to work in a department that deals with internet security. This department had an "internal" website (only people in the building can get on it) and an "external" website (anyone in the world can get on it --... (1 Reply)
Hello,
I have two strings those are outputs of two echo commands:
$ logslist=`ls -1rt vp_lb_indv*.log | tail -1`; tail -7 $logslist | head -1
ERROR: Errors printed on pages 5,22.
$ logslist=`ls -1rt vp_lb_indv*.log | tail -1`; errpages=`tail -7 $logslist | head -1`; echo... (3 Replies)
Hello,
I am trying to send text to a USB to serial adaptor and then to an external speech synthesizer. I tried using the cat and echo commands with no luck. I have gotten some audio output from my synthesizer using Kermit a terminal emulator, so I am pretty sure my synthesizer and my USB to serial... (1 Reply)
I am writing a Bash script that needs to get part of the current directory path. Let's say the current directory is /cat/dog/bird/mouse/ant. I know that the part that I want is between "bird/" and "/ant". In this case, I would want to set a variable to "mouse".
If the current directory were... (4 Replies)
I have a file containing data lines:
1|14|CONSTANT||11111111||00887722||30/04/2012|E|O|X||||20120528093654-30.04.2012|STA11ACT|ddts555S||||00001|rrttbbggcc|
1|15|CONSTANT||22222222||00887722||30/04/2012|E|O|X||||20120528093654-30.04.2012|rrtha772|llkis000||||00001|AAEtbbggcc|
I want to add a... (3 Replies)
I have file like below
1|4|OR|OLAP|INT|INT||CONSTANT|2012/08/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|55791|LNR|
2|4|OR|OLAP|CLR|CLR||CONSTANT|2012/09/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|57891|REGS|... (2 Replies)
I wonder string constant exists permanently or temporary.
For example,
printf("hello, world");
the function printf access to it is through a pointer. Does it mean storage is allocated for the string constant to exist permanently in memory? :confused: (4 Replies)
trying to sort an array, only the 4th column is uniq,
have this:
dog cat bird house1
dog cat bird house2
dog cat bird house3
rose daisy tulip house1
rose daisy tulip house3
would like this:
dog cat bird house1 house2 house3
rose daisy tulip house1 missing house3
any help... (6 Replies)