#tutorials online tutorial programming web tutorials html css css3 php php5 asp bootstrap ajax mysql javascript earning
Explore tagged Tumblr posts
Text
HOW TO LEARN PHP? PHP TUTORIALS!
Answer: PHP is a most powerful Web programming language. It is a most useful for web development. It is an HTML embedded, server-side scripting language designed for web development.
If any developer wants to build a nice dynamic website so he should be using PHP. Because PHP is an open source programming Language for all. By this PHP Tutorials, you can learn how to make a dynamic website using PHP.
The PHP full meaning is Hypertext Preprocessor (earlier called, Personal Home Page)
Basic Structure of PHP
<!DOCTYPE html> <html lang="en"> <head> <title>PHP Tutorials</title> </head> <body> <?php echo "Hello World! This is First PHP Programming."; ?> <p>Output</p> Hello World! This is First PHP Programming. </body> </html>
Output: This code simple generate below output
PHP DATA TYPES
PHP variables do not need to be declared before the assignment, it is declared at the time of assignment by the leading of dollar sign ($). PHP variables can store different types of data, there is no need to declared data types before or at the time of assignment.
There are eight data types in PHP
- Strings
- Integers
- Float or Doubles
- Booleans
- Null
- Array
- Objects
- Resources
How many data types in PHP? There are eight data types in PHP such as Strings, Integers, Float or Doubles, Booleans, Null, Array, Objects, Resources.
PHP VARIABLE
In the middle of PHP programs, we can store temporary data through PHP variables. There is no need to declared a variable before assigning the value. PHP variable starts from the $ sign.
How to declare PHP Variable?
PHP Variable declare using dollar sign ($)
How to use PHP Variable?
First declare a PHP variable then it call any place of page or another page where declare page already included.
PHP Variable Example
<!DOCTYPE html> <html> <body> <?php $php_string = "This is a string"; $php_integer = 357; $php_float = 5.201; ?> <p>This is a PHP string variable example : <?php echo $php_string; ?></p></br> <p>This is a PHP integer variable example : <?php echo $php_integer; ?></p></br> <p>This is a PHP float variable example : <?php echo $php_float; ?></p> </body> </html>
PHP CONSTANT
PHP Constants is a predefined function of PHP. It is just like a variable but the difference is that PHP Constants used as a global variable and once it is defined it cannot change during the execution of the script.
What is PHP Constants?
PHP Constants is a predefined function of PHP
Syntax of PHP Constants is define(name, value, case-insensitive).
PHP Constant Example
<!DOCTYPE html> <html> <body> <?php define("WISHES", "Hello John !"); ?> <p>This is a PHP Constant variable example : <?php echo WISHES;?></p></br> <p>Same thing will print : <?php echo constant("WISHES");?></p> </body> </html>
The above code produces the following results
PHP STRINGS
PHP string is a collection of characters i.e. "Hello John!". A PHP string value must stay with " ".
What is PHP string? When a value stays within " " then it's called be PHP String. Like "Hello John!"
These are valid example of strings in PHP
<!DOCTYPE html> <html> <body> <?php $first_string = 'This is a string in single quotes'; $second_string = "This is a string in double quotes"; ?> <p>First String : <?php echo $first_string;?></p></br> <p>Second String : <?php echo $second_string;?></p></br> </body> </html>
The above code produces the following results
PHP OPERATORS
PHP operators are used to performing some specific operation on variables and values.
What are PHP Operators?
PHP Operators operand one or more than one Operand.
These operators supported by PHP language.
-Assignment Operators
-Arithmetic Operators
-Comparison Operators
-Conditional / Ternary Operators
-Logical / Relational Operators
PHP IF ELSE IF
You can decide that which part of code want to execute and which part don't by using if and else...if...else statement. You can use this conditional statement for your decision.
if statement (Execute the part of code when the condition will be true)
if else statement (Execute if condition part of code when the condition will be true otherwise else part of the code will be executed)
if..elseif..else statement (Execute some part of code for more than two conditions)
Syntax and Example for if statement
if(condition){
// This part of code will be executed if condition will be true
}
<!DOCTYPE html> <html> <body> <?php $a = 7; $b = 5; if($a > $b) { ?> <p>if part execute when condition true : <?php echo $a . ' is greater than ' .$b;?></p> <?php } ?> </body> </html>
The above code produces the following results
Syntax and Example for if else statement
if(condition){
// This part of code will be executed if condition will be true
} else {
// This part of code will be executed if condition will be false
}
<!DOCTYPE html> <html> <body> <?php $a = 7; $b = 5; if($a < $b) { ?> <p>if part execute when condition will be true : <?php echo $a . ' is greater than ' .$b;?></p> <?php } else { ?> <p>else part execute when condition will be false : <?php echo $b . ' is less than ' .$a;?></p> <?php } ?> </body> </html>
The above code produces the following results
1 note
·
View note