We are going to start a new tutorial series “PHP Tutorial for Beginners” in Urdu language. A simple and short PHP tutorial and complete reference manual for all built-in PHP functions. These tutorials are for beginners to advance level. You will learn PHP Built-in Function, PHP syntax, PHP variables, Object Oriented PHP, Numbers, Scalars, Arrays, Hash File I/O, IF, ELSEIF, Do, While Loops, Operators, Regular Expressions, GET, POST, Subroutines, Coding Standard, Modules, File Management, Socket Communication, Reference, Special Variables, Syntax Overview, Form Validation, Advanced PHP, Library, Web Design, PayPal Integration, MySQL Login, Ajax Search, Ajax XML Parser, Ajax Auto Complete Search, Ajax RSS Feed Example, XML Introduction, Simple XML, Simple XML GET, SAX Parser Example, DOM Parser Example, Frame Works, Core php vs frame works php, Design Patterns.
In our last lecture we learned about PHP syntax, how to write hello world program. If you haven’t watched it yet then here is the link of tutorial http://tutorialhive.net/2018/09/08/2-php-syntax-php-website-development/ . Today’s tutorial is about PHP variables.
In this tutorial we will learn about PHP variables and how to declare variables in php. What are the rules we need to follow.
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.
In between <?php ?> write $ sign and then your variable name. Close your line with semi colon $name; just like this. PHP is loosely coupled type language so that’s why don’t need to declare data type in variable declaration.
In In order to display we write echo “$name”; this will display variable name value on screen.
Dot operator is used to concatenate string in php.
echo “My name is”. $name; or echo “My name is”. “$name”;
Open your browser and write localhost/folder name in which you have file/filename with extension and enter.
Output: My name is Husnain
PHP variables tutorial end here. In next tutorial we will learn about data types 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: https://www.youtube.com/channel/UCOUy6kTpedj7s6HOqM0c08w
Follow us on Social Media