In this video

Today we are going to learn about constants in PHP. In our last lecture we learned about string functions in PHP. If you haven’t watched it yet then here is the link of tutorial Today’s tutorial is about constants in PHP.

Constants in PHP

In this tutorial we will learn about constants in PHP and how to declare constants in PHP. First step is to run wamp server. Run wamp and after that go into drive where you installed wamp server. Open folder Wamp after that open folder www. Now create a new folder in ‘www‘ you can give any name to your folder, I am naming it tutorialhive. In folder create a file with name index.php. In your editor open your php file.


Constant is a value which remain same during your program or script.

Constant Declaration method

define(name, value);


define(“AGE”, 22);

echo AGE;


Output: 22

Mostly developers prefer to write constants in PHP in Capital, so it is easy to find them.

Third parameter of define function

Define function has total three parameters. First is name then value and third one is for case sensitive. By default it is false which means it is case insensitive so whenever you have to call constant call it as it is. If it is true then does not need to worry about caps or small e.g. you can write’ echo AGE or age’.

Constants in PHP tutorial end here. In next tutorial we will learn about IF ELSE  in php. If you have any queries you can ask us on our Facebook page link is given below, Thank you for watching us.


Tutorial Hive’s mission is to provide quality education to all our community. Tutorial Hive’s mission is to provide free education to all those who cannot afford BIG FEE of institutes. We aim specifically to empower youth to understand programming related knowledge which further helps the society to reduce complex problems through applications. Why Tutorial Hive? We not only provide the theoretical knowledge but also provide the actual implementation with working sample applications. Tutorial Hive cannot achieve its mission without the help of our community. So, please if you think you can help in any manner feel free to contact us. Or if you see any mistake in our content which can be modified/corrected then please leave us a message

We are always open for suggestions.


Subscribe on YouTube:

Follow us on Social Media

You might be interested in


Your email address will not be published. Required fields are marked *