PHP Variables
A PHP
variable starts with sign ‘$’ and variable name contains only
( _ ,
a-z , A-Z , 0-9 ).
(Note: PHP
is a case sensitive. ‘a’ and ‘A’ are different names and don’t use spaces in
variable name)
Some
examples of variables are:-
$myname=”softfive”;
$_myname=”softfive”;
$1=”softfive”;
<html>
<head></head>
<body>
<?php
$myname=”softfive”;
echo “my
name is: “ ”.” ”$myname”;
// “.” Is
used for concatenation two things
?>
</body>
</html>
PHP Operators
Now the
question comes that what operators you will use in PHP
Array
operators:-
1) a==b // both have same values
2) a+b // union of a and b
3) a===b // checks the value types
4) a!=b or a<>b // checks a is not equal to b
5) a.b // concatenation
1) a==b // both have same values
2) a+b // union of a and b
3) a===b // checks the value types
4) a!=b or a<>b // checks a is not equal to b
5) a.b // concatenation
Logical
operators:-
1) a && b // AND operator
2) a || b // OR operator
3) !a // NOT operator
1) a && b // AND operator
2) a || b // OR operator
3) !a // NOT operator
Arithmetic
operators:-
1) a + b // add
2) a – b //subtract
3) a * b //multiplication
4) a / b //division
5) –a //minus a
1) a + b // add
2) a – b //subtract
3) a * b //multiplication
4) a / b //division
5) –a //minus a
Assignment
operators:-
1) a=a+b
2) a=a-b
3) a=a*b
4) a=a/b
5) a=a%b
6) a=b
Other operators:-
1) ++a // pre increment
2) a++ // post increment
3) - -a
// pre decrement
4) a--
//post decrement
5) a==b // comparison
6) a>b
7) a<b
8) a>=b
9) a<=b
10) a!=b