Skip to content

Instantly share code, notes, and snippets.

@rurtubia
Created November 17, 2015 00:24
Show Gist options
  • Save rurtubia/f61c41c08c2c0c2d8330 to your computer and use it in GitHub Desktop.
Save rurtubia/f61c41c08c2c0c2d8330 to your computer and use it in GitHub Desktop.
PHP Constants
<?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