HTML
How to download HTMl Editors
How to use HTML tags
How to Comment in HTML
How to create an HTML link
How to link to a specific part of a page HTML
How to Insert Images with HTML
How to insert audio in HTML
How to insert videos in HTML
How to use Table Tag in HTML
How to Use HTML List Elements
How to use HTML Iframe
How to use HTML Symbols
How to use HTML Color Codes
How to Create HTML From
How to learn HTML
CSS
How to use CSS Background
JS
PHP
How to redirect to another page using PHP
How to get last inserted id in MySQL using PHP
How to learn php
How to insert a row into database by using PHP
How to fetch data from table by using php
How to print table data by using while loop in php
How to perform search operation into database by using php
MySQL
How to create Table in PHP MySQL?
How to Insert Data Into MySQL Database Table Using PHP?
How to Select Data from MySQL Database Tables Using PHP
How to Update data in MySQL Database Table using PHP
How to Delete Data from MySQL using PHP
How to make MySQL query ORDER BY conditions
How to Select LIMIT data in PHP MySQL
SQL
BOOTSTRAP
AJAX
DATATABLE
SEO
EARNING
YOUTUBE
WordPress
How to Install WordPress?
How to use WordPress Dashboard?
How to Install Plugins in WordPress?
How to Customize WordPress Plugins?
How to Change General Settings in WordPress?
How to Change Writing Settings in WordPress
How to Setup the Reading Settings in WordPress
How to Setup the Discussion Settings in WordPress
How to Setup the Media Settings in WordPress
How to Setup the Permalink Settings in WordPress
How to Setup the Plugin Settings in WordPress
How to Add Categories to WordPress
How to Edit Category in WordPress
How to Delete Category in WordPress
How to Arrange Category in WordPress
How to Add a new Post in WordPress
How to Edit Post in WordPress
How to Delete Post in WordPress
How to Review Post in WordPress
How to add Media in WordPress
How to Edit Media in WordPress
How to add a Page in WordPress
How to Delete Media in WordPress
How to Add Page in WordPress
How to Edit Pages in WordPress
How to Learn WordPress
How to Delete Page in WordPress
How to add New Tag in WordPress
How to Edit Tags in WordPress
How to Delete Tags in WordPress
How to Add Comments in WordPress
How to Edit Comments in WordPress
How to Moderate Comments in WordPress
How to Add User in WordPress
How to Edit User in WordPress
How to Delete User in WordPress
How to Manage WordPress Themes
How to Customize Theme in WordPress
How to Manage Widget in WordPress
How to Change Background in WordPress
How to Transfer Host in WordPress
How to Update Version in WordPress
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
Hello World! This is First PHP Programming.
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.
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 usign 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.
<!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>
The above code produces the following results
Outputs: This is a PHP string variable example: This is a string
This is a PHP integer variable example: 357
This is a PHP float variable example: 5.201
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
Outputs: This is a PHP Constant example: Hello John!
Same thing will print: Hello John!
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
Outputs: First String: This is a string in single quotes
Second String: This is a string in double quotes
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
Learn more PHP OPERATORS
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)
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
Outputs: if part execute when condition will be true: 7 is greater than 5
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
Outputs: else part execute when condition will be false: 5 is less than 7
if(condition){
// This part of code will be executed when condition will be true
}else if(condition){
// This part of code will be executed when condition will be true
} else {
// This part of code will be executed when both above conditions will be false
}
<!DOCTYPE html>
<html>
<body>
<?php
$a = 7;
$b = 5;
if($a < $b) {
?>
<p>This part execute when condition will be true : <?php echo $a . ' is greater than ' .$b;?></p>
<?php
} else if($b < $a){
?>
<p>This part execute when condition will be true : <?php echo $b . ' is less than ' .$a;?></p>
<?php
} else {
?>
<p>This part execute when both condition will be false : <?php echo $b . ' is not less nor greater ' .$a;?></p>
<?php
}
?>
</body>
</html>
The above code produces the following results
Outputs: This part execute when condition will be true: 5 is less than 7