PHP Constants

Constants are same like variables but once constants values are defined it can not be changed or undefined. Constants are used to define settings/configurations which remains same through out the execution. actually constants are used when you want a surety that these values will not change in throughout program execution cycle.

Define Constant

Define constant is very simple like define(“constant name”,”Value”);

<!doctype html>	
<html>
	<head>
	<title>
		PHP Constants
	</title>
	</head>
	<body>
		<?php
			define("WELCOME","Welcome to PHPDocs.com!");
			
			echo WELCOME; //this is will output Welcome to PHPDocs.com!
		?>
	</body>
</html>