There are four basic operators in PHP.
1.Arithmetic operators + - * %.
2.Logical operator && || !
3.Conditional operator (exp1) ? exp2 : exp3.
4.Unary operator ++/-- (pre/post)
these operator are very useful and used frequently in programming.
comment style in PHP :-
1. simple style for single line comment
//write your comment
2. multi line comment for large documentation
/*this blog is for those who want to learn PHP for free*/
Generating output in PHP : -
a simple PHP program :-
<html>
<head>
<title>My first PHP programming.</title>
<body>
<?php //opening tag
echo "My first PHP programming!";
?> // closing tag
</body>
</head>
.
Output : My first PHP programming!
the above program simply embed a small PHP code echo "My first PHP programming!";
we use either echo or print for output something from PHP code as we have done above.
for outputting a variable , e.g.
$var = "My first PHP programming!";
echo $var;
simply output My first PHP programming!
string concatenation in PHP : -
use dot(.) to concatenate to strings , e.g.
echo "My"."Blog";
would output :- My Blog
1.Arithmetic operators + - * %.
2.Logical operator && || !
3.Conditional operator (exp1) ? exp2 : exp3.
4.Unary operator ++/-- (pre/post)
these operator are very useful and used frequently in programming.
comment style in PHP :-
1. simple style for single line comment
//write your comment
2. multi line comment for large documentation
/*this blog is for those who want to learn PHP for free*/
Generating output in PHP : -
a simple PHP program :-
<html>
<head>
<title>My first PHP programming.</title>
<body>
<?php //opening tag
echo "My first PHP programming!";
?> // closing tag
</body>
</head>
.
Output : My first PHP programming!
the above program simply embed a small PHP code echo "My first PHP programming!";
we use either echo or print for output something from PHP code as we have done above.
for outputting a variable , e.g.
$var = "My first PHP programming!";
echo $var;
simply output My first PHP programming!
string concatenation in PHP : -
use dot(.) to concatenate to strings , e.g.
echo "My"."Blog";
would output :- My Blog
No comments:
Post a Comment