A variable is a storage area. You put things into your storage areas
(variables) so that you can use and manipulate them in your programmers. Things
you'll want to store are numbers and text.
Variable in PHP |
You can't begin their names with an underscore (_), or a
number. But most other characters are fine.
Example 1 :
A person is going to be collecting the books. But we can
specify how many books he will be collecting. If you have five books to give him, then you do the
"Answer" is like this:
Answer is = 5 Books
Ok, now going to the subject …
you're studying PHP, so there's something missing. Two
things, actually. First, your people (variables) need a dollar sign at the
beginning (people are like that). So it would be this:
$books = 10
Examples 2 :
try to do
$books=10+20+30;
What is your answer : answer must be 60
Example 3 :
Test your mind
Find the total books ?
$english_book=10;
$maths_book=5;
Software Engineer Thilina |
So, then we can proof this
$total_book=$english_book+maths_book;
Out put is15
In the next part, we'll take a look at how to use
String types.
Comments
Post a Comment