Created
November 17, 2015 00:24
-
-
Save rurtubia/f61c41c08c2c0c2d8330 to your computer and use it in GitHub Desktop.
PHP Constants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Declaring a constant. | |
//Constants do not start with a "$" sign. | |
//They need to be declared by using the function "define()" | |
//define() syntax: | |
#name: name for the constant. | |
#value: value for the constant. | |
#case-insensitive: default is false. | |
//case sensitive constant: | |
define(numero_dos, 2); | |
//case insensitive constant: | |
define(numero_cero, 0, true); | |
//All constants are global: | |
//They can be used across the entire script: | |
define(saludo, "Hello World"); | |
function myFuncion(){ | |
echo saludo; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment