PHP constants

巴扎黑
Release: 2016-11-12 09:52:40
Original
1262 people have browsed it

Set PHP constants

To set constants, use the define() function - it takes three parameters:

The first parameter defines the name of the constant

The second parameter defines the value of the constant

The optional third This parameter specifies whether the constant name is case-sensitive. The default is false.

The following example creates a case-sensitive constant with the value "Welcome to W3School.com.cn!":

Instance

<?php
define("GREETING", "Welcome to W3School.com.cn!");
echo GREETING;
?>
Copy after login

Running instance

The following example creates a case-insensitive constant, The value is "Welcome to W3School.com.cn!":

Instance

<?php
define("GREETING", "Welcome to W3School.com.cn!", true);
echo greeting;
?>
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template