11
May
Posted by navid100 in PHP. Tagged: php, PHP Functions, PHP lessons, PHP Tutorial, web. Leave a Comment
The real power of PHP comes from its functions.
In PHP – there are more than 700 built-in functions available.
PHP Functions
In this tutorial we will show you how to create your own functions.
For a reference and examples of the built-in functions, please visit our PHP Reference.
Create a PHP Function
A function is a block of code that [...]
Continue reading »
11
May
Posted by navid100 in PHP. Tagged: Looping, php, PHP lessons, PHP Looping, PHP Tutorial, tutorials, web. Leave a Comment
Looping statements in PHP are used to execute the same block of code a specified number of times.
Looping
Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to perform this.
In PHP we have the following looping [...]
Continue reading »
11
May
Posted by navid100 in PHP. Tagged: Associative array, Multidimensional array, Numeric array, php, PHP Arrays, PHP lessons, PHP Tutorial, tutorials. Leave a Comment
An array can store one or more values in a single variable name.
What is an array?
When working with PHP, sooner or later, you might want to create many similar variables.
Instead of having many similar variables, you can store the data as elements in an array.
Each element in the array has its own ID [...]
Continue reading »
11
May
Posted by navid100 in PHP. Tagged: Conditional Statements, php, PHP If...Else Statements, PHP lessons, PHP Tutorial, The ElseIf Statement, tutorials, web. Leave a Comment
The if, elseif and else statements in PHP are used to perform different actions based on different conditions.
Conditional Statements
Very often when you write code, you want to perform different actions for different decisions.
You can use conditional statements in your code to do this.
if…else statement – use this statement if you want to execute [...]
Continue reading »
11
May
Posted by navid100 in PHP. Tagged: Arithmetic Operators, PHP lessons, PHP Operators, PHP Tutorial, tutorials, web. Leave a Comment
Operators are used to operate on values.
PHP Operators
This section lists the different operators used in PHP.
Arithmetic Operators
Operator
Description
Example
Result
+
Addition
x=2
x+2
4
-
Subtraction
x=2
5-x
3
*
Multiplication
x=4
x*5
20
/
Division
15/5
5/2
3
2.5
%
Modulus (division remainder)
5%2
10%8
10%2
1
2
0
++
Increment
x=5
x++
x=6
–
Decrement
x=5
x–
x=4
Assignment Operators
Operator
Example
Is The Same As
=
x=y
x=y
+=
x+=y
x=x+y
-=
x-=y
x=x-y
*=
x*=y
x=x*y
/=
x/=y
x=x/y
.=
x.=y
x=x.y
%=
x%=y
x=x%y
Comparison Operators
Operator
Description
Example
==
is equal to
5==8 returns false
!=
is not equal
5!=8 returns true
>
is greater than
5>8 returns false
<
is less than
5<8 returns true
>=
is greater than or equal to
5>=8 returns false
<=
is less than or equal to
5<=8 returns true
Logical Operators
Operator
Description
Example
&&
and
x=6
y=3(x [...]
Continue reading »
11
May
Posted by navid100 in PHP. Tagged: PHP lessons, PHP String, PHP Tutorial, string variable, Strings in PHP, tutorials, web. Leave a Comment
A string variable is used to store and manipulate a piece of text.
Strings in PHP
String variables are used for values that contains character strings.
In this tutorial we are going to look at some of the most common functions and operators used to manipulate strings in PHP.
After we create a string we can manipulate it. [...]
Continue reading »
comments