Thursday, 28 December 2017

Working with php Variables and Data Types really fun

Hello guys today we are going to work with php variable and data types the fun aspect of PHP, what you need is and editor and php engine(Apache Server) to power our script to run.

To declare a variable in php is really simple, use the dollar sign($) followed by a name of your choice that relate to your context, for example

$storeName="Your name";

Because i want t store string/letter, make sure you use double quote when you are dealing with string or letter.

Always follow variable naming principle, use underscore, don't start with number, or hyphen or any special character such as this @#$%^&*()-=+

Example Two:

To store integer or float number see sample code
$MyNumber=23;
$myFloat=299.00;

We are going to deal with function later on, that will bring us to - local scope

If you don't want your code to get error simply use semi-colon to terminate after everything, this tell the system that this line of code has done it job.

No comments:

Post a Comment