The following source code explains how to define a constant in php.
Source Code
/********************************************************************************/
<html>
<head>
<title>Constants</title>
</head>
<body>
<?php
$num1=90;
define("num2",90);
/*
num1 is a variable
but
num2 is a constant */
$num1+=20;
/*
the following statement is not allowed
as
num2 is a constant
num2+=20;
*/
?>
</body>
</html>
/********************************************************************************/
Note that the following program will not generate any output.
No comments:
Post a Comment