PHP CONSTANTS

Sugar babies

 PHP CONSTANTS

  • A constant is an identifier (name) for a simple value.
  • The value cannot be changed during the script.
  • A valid constant name starts with a letter or underscore (no $ sign before the constant name).
  • In Algebra, a constant is a number on its own, or sometimes a letter such as a, b or c to stand for a fixed number. 
                               Example: in "x + 5 = 9", 5 and 9 are constants.

FIVE CONSTANTS IN PHP :

  • The speed of light in vacuum, c;
  • The Planck constant, h;
  • The elementary charge, e;
  • The Avogadro constant, NA;
  • The Boltzmann constant, kB.

SYNTAX FOR CONSTANTS IN PHP :

const data_type constant_name = value; 

EXAMPLE FOR CONSTANTS IN PHP :

< ! DOCTYPE html>
<html>
<body>
<?php
// case - sensitive constant name 
define ("GREETING" , "Welcome to
dance program! " ) ;
echo  GREETING;
</body>
</html>
?>

OUTPUT :

Welcome to dance program!
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send