Loading, please wait...

A to Z Full Forms and Acronyms

How to create a constant using define() function in PHP | PHP programs

Jan 20, 2022 PHP, 1199 Views
How to create a constant using define() function in PHP | PHP programs

How to create a constant using define() function in PHP | PHP programs

We will create a PI constant using the define() function and calculate the area of the circle.

<?php


define(PI, 3.14);

$radius = 10;

$area = PI * $radius * $radius;

print ("Area of circle: " . $area);
?>
A to Z Full Forms and Acronyms