Wednesday, May 29, 2019

PHP Include And Require Statement !!

PHP Include And Require Statement !!



In this article we will discuss about PHP Include And Require Method in brief.

We can insert the content of one PHP file into another PHP file

In PHP there are two ways to include file 


Include


It copies all files, texts, documents of one file to another file.

Syntax :

include ( " file name " ) ; 

Program :

home.html


wel.php


Output :


As shown in above program we copy data of hello.html file in wel.php file.

Form which we created in hello.html file it shown in wel.php file when we execute it.

Require


It copies all files, texts, documents of one file to another file.

It is used when file is require by the application.

Syntax :

require ( " file name " ) ; 

Program :

home.html



web.php


Output :


Same as include file we copy data of hello.html file into wel.php file.

Both include and require works same.

Difference Between Include & Require


The require & include both statement is used to  include a file into the PHP code.

The difference between include and require is,

require is used when file is required by the application.

If file is not found in require method then execution will stop.

Include is used when file is not required by the application.

If file is not found in include method then execution will continue.
Mesothelioma Survival Rates , Mesothelioma Attorneys California , Seattle Mesothelioma Lawyer , Mesothelioma Suit , Mesothelioma Claim , Wisconsin Mesothelioma Attorney , Mesothelioma Attorney illinois , Mesothelioma Trial Attorney ,Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , New York Mesothelioma Law Firm,Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyers San Diego,Mesothelioma Litigation , Mesothelioma Attorney Assistance , Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyer Chicago , New York Mesothelioma Law Firm , 


Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , Lawsuit Mesothelioma  , Truck Accident Attorney Los Angeles ,Asbestos Exposure Lawyers  , Mesothelioma Cases  , Emergency Response Plan ppt , Mesothelioma Lawyers San Diego  , Asbestos Mesothelioma Lawsuit  , Tennessee Mesothelioma Lawyer , Meso Lawyer  , Mesothelioma Settlements Amounts  , Mesothelioma Law Firms , New Mexico Mesothelioma Lawyer , Accident Attorneys Orange County , Mesothelioma Lawsuit ,Personal Injury Accident Lawyer  , Purchase Structured Settlements  , Firm Law Mesothelioma , Car Accident Lawyers Los Angeles , Mesothelioma Attorneys , Structured Settlement Company  , Auto Accident Lawyer San Francisco  , Mesotheolima  , Los Angeles Motorcycle Accident Lawyer


Mesothelioma , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois , Mesothelioma Drug , Mesothelioma Attorney DirectoryMesothelioma Settlements , Mesothelioma Help  , Mesothelioma ct , Mesothelioma Attorney Florida , Washington Mesothelioma Attorney , Best Mesothelioma Lawyers , Diagnosed With Mesothelioma , Mesothelioma Settlement Amounts , Mesothelioma Personal Injury Lawyers , Mesothelioma Compensation , Attorney Lawyer Mesothelioma  ,Colorado Mesothelioma Lawyers,Mesothelioma Lawsuits , Mesothelioma Claims , Average Mesothelioma Settlement , Average Mesothelioma Settlement , Mesothelioma Law Suit , Alabama Mesothelioma Lawyer , alabama Mesothelioma Lawyer , utah mesothelioma lawyer , Dallas Mesothelioma Lawyer , Mesothelioma Attorney California , Mesothelioma Lawyer California ,Mesothelioma Survival Rates ,

Mesothelioma Attorneys California, Wisconsin Mesothelioma Attorney Mesotheliama , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois, Mesothelioma Trial Attorney Injury Lawyer Houston tx , Baltimore Mesothelioma Attorneys , Mesothelioma Care ,Mesothelioma Trial Attorney ,Mesothelioma Lawyer Texas , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , California Mesothelioma Attorney Philadelphia Mesothelioma Lawyer , Illinois Mesothelioma Lawyer , Mesothelioma Attorney , Mesothelioma Claims , Average Mesothelioma Settlement 
Integrated ehr , Mesothelioma Law Sui , Mesothelioma Lawyer California,Mesothelioma Attorney California ,Mesothelioma Law Suits ,Dallas Mesothelioma Attorneys ,Mesothelioma Drug ,Mesothelioma Attorney Directory

PHP Functions !!

PHP Functions !!



In this article we will discuss about PHP functions in brief.

PHP Functions


A function is a block of some code which is designed to  perform particular task.

Why Functions ?



  • Increase the readability
  • For code re-usability
  • less code


Types Of Functions 


1) Predefined Functions
2) User defined Functions

1) Predefined Functions


Predefined functions are functions which is php provide us.

It is already defined.

Let's see some predefined functions 

echo : echo is used for print the message.

which is defined already in php.

PHP interpreters knows how predefined functions works.

Program :



Output :

Predefined Functions

User defined Functions


User defined functions are made by user according to requirements.

It reduce the code lines.

It uses when we have to use same code many times in a program.

We create a function once and use whenever needed.

Syntax :

function name_userfunction( )
{
    code of block
}

Where, function is keyword for create a function.

name_userfunction is name of your function you can write any thing here.

Program :


Output :

Hello !! function is created

Here, we created hello() function and print message in the function.

After that for call the function we just need to write function name like here we call function by write hello().

It is not necessary to call function in same block where you declare the function.

Function can call anywhere in the program where we needed.

Function With Argument


We can pass argument in the function parameter.

It is used for give value at run time.

We pass string or integer or any kind of data which we want to print.

Syntax :

function name_userfunction(arguments)
{
    code of block
}

Program :


Output :

Hello !! Welcome NibKarma

Here we take and argument $name and at declaration time we pass the string "NibKarma".

We can also use a variable as a argument in function call.

This argument pass value to the parameter of function.

Program :


Output :

nibkarma

Here we store a string in variable $a and pass in the function argument which is replace by $ name and prints the nibkarma.

In this article we discuss about functions both predefined and user defined in brief.




Mesothelioma Survival Rates , Mesothelioma Attorneys California , Seattle Mesothelioma Lawyer , Mesothelioma Suit , Mesothelioma Claim , Wisconsin Mesothelioma Attorney , Mesothelioma Attorney illinois , Mesothelioma Trial Attorney ,Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , New York Mesothelioma Law Firm,Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyers San Diego,Mesothelioma Litigation , Mesothelioma Attorney Assistance , Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyer Chicago , New York Mesothelioma Law Firm , 


Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , Lawsuit Mesothelioma  , Truck Accident Attorney Los Angeles ,Asbestos Exposure Lawyers  , Mesothelioma Cases  , Emergency Response Plan ppt , Mesothelioma Lawyers San Diego  , Asbestos Mesothelioma Lawsuit  , Tennessee Mesothelioma Lawyer , Meso Lawyer  , Mesothelioma Settlements Amounts  , Mesothelioma Law Firms , New Mexico Mesothelioma Lawyer , Accident Attorneys Orange County , Mesothelioma Lawsuit ,Personal Injury Accident Lawyer  , Purchase Structured Settlements  , Firm Law Mesothelioma , Car Accident Lawyers Los Angeles , Mesothelioma Attorneys , Structured Settlement Company  , Auto Accident Lawyer San Francisco  , Mesotheolima  , Los Angeles Motorcycle Accident Lawyer


Mesothelioma , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois , Mesothelioma Drug , Mesothelioma Attorney DirectoryMesothelioma Settlements , Mesothelioma Help  , Mesothelioma ct , Mesothelioma Attorney Florida , Washington Mesothelioma Attorney , Best Mesothelioma Lawyers , Diagnosed With Mesothelioma , Mesothelioma Settlement Amounts , Mesothelioma Personal Injury Lawyers , Mesothelioma Compensation , Attorney Lawyer Mesothelioma  ,Colorado Mesothelioma Lawyers,Mesothelioma Lawsuits , Mesothelioma Claims , Average Mesothelioma Settlement , Average Mesothelioma Settlement , Mesothelioma Law Suit , Alabama Mesothelioma Lawyer , alabama Mesothelioma Lawyer , utah mesothelioma lawyer , Dallas Mesothelioma Lawyer , Mesothelioma Attorney California , Mesothelioma Lawyer California ,Mesothelioma Survival Rates ,

Mesothelioma Attorneys California, Wisconsin Mesothelioma Attorney Mesotheliama , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois, Mesothelioma Trial Attorney Injury Lawyer Houston tx , Baltimore Mesothelioma Attorneys , Mesothelioma Care ,Mesothelioma Trial Attorney ,Mesothelioma Lawyer Texas , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , California Mesothelioma Attorney Philadelphia Mesothelioma Lawyer , Illinois Mesothelioma Lawyer , Mesothelioma Attorney , Mesothelioma Claims , Average Mesothelioma Settlement 
Integrated ehr , Mesothelioma Law Sui , Mesothelioma Lawyer California,Mesothelioma Attorney California ,Mesothelioma Law Suits ,Dallas Mesothelioma Attorneys ,Mesothelioma Drug ,Mesothelioma Attorney Directory

PHP Different Operators !!

PHP Different Operators !!



PHP Operators 


Operators are used for perform different kinds of operation on values.

We can do different operation using operators on different values.

There are operators we can use in PHP


Arithmetic Operators


Arithmetic operators are used to perform simple mathematical operations like addition, subtraction, multiply, division and modulo.

operator syntax operation
+ $a + $b addition of operands
- $a - $b subtraction of operands
* $a * $b multiplication of operands
/ $a / $b division of operands
% $a % $b reminder of operands

Program :

<?php

     $x= 10      $y= 3 
      echo "The sum is : ". ($x+$y) 
      echo "The difference is : ". ($x-$y)
      echo "Multiplication is : ". ($x*$y)
      echo "Division is : ". ($x/$y)
      echo "Modulus is : " . ($x%$y)
?>

Output :


The sum is : 13
The difference is : 7
Multiplication is : 30
Division is : 3.333333
Modulus is : 1


Logical Operators


This operators are used in conditional statements.it is used to check true or false conditions.

Operators is used like logical and, logical or, logical not, and, or, xor.

operator syntax operation
&& $a && $b true if both operands are true otherwise false
|| $a || $b true if either one of both operands are true otherwise false
! !$b true if $b false
and $a and $b true if both operands are true otherwise false
or $a or $b true if either one of both operands are true otherwise false
xor $a xor $b false if both operands are true otherwise true

Program :

<?php
$name=”Nibkarma”;$pass=”123”;
if($name==”NibKarma” && $pass==”123”){echo “Welcome to Nibkarma”;}else{echo “Invalid username or Password”;}
?>


Output :

Welcome to NibKarma


Comparison Operators


Comparison operators are used to compare the variables.

It returns the Boolean value either true or false.

Operators like <, >, <=, >=, ==, != is used.

operator syntax operation
> $a > $b true if a is greater then b
>= $a >= $b true if a is greater then or equal to b
< $a < $b true if a is less then b
<= $a <= $b true if a is less then or equal to b
== $a == $b true if both operands are same
!= $a != $b true if a is not equal to b

Program :


<?php
$a =5;$b =7;
if($a==$b){echo “Equal”;}else{echo “Not Equal”}
?>


Output :


Not Equal


Assignment Operators


Assignment operation used to assign value to the operator without do extra operations.

Operators like =, +=, -=, *=, /=, %= is used.

operator syntax operation
= $a = $b true if a is equal to b
+= $a += $b addition as $a = $a + $b
-= $a -= $b subtraction as $a = $a - $b
*= $a *= $b multiplication as $a = $a * $b
/= $a /= $b division as $a = $a / $b
%= $a %= $b modulo as $a = $a % $b

Program :


<?php 

$a=12;$b=$a;

echo $b; echo "<br>";

$a+=$b;echo $a;echo "<br>";

$a-=$b;echo $a;echo "<br>";

$a*=$b;echo $a; echo "<br>";

$a/=$b;echo $a;echo "<br>";

$a%=$b;echo $a;echo "<br>";

$a.=$b;echo $a;
?> 


Output :

122412144120012


Increment/Decrement Operators


This operators are used for increment or decrement the value of operators.

++ and -- operators are used.

operator syntax operation
++ ++$a pre-increment : first increment then prints
++ $a++ post-increment : first print then increment
-- --$a pre-decrement : first decrement then print
-- $a-- post-decrement : first print then decrement


Program :

<?php
$a=12;$b=++$a;echo "a=".$a." ,b=".$b; //prints a=13 ,b=13echo "<br>";
$b=$a++;echo "a=".$a." ,b=".$b; //prints a=14 ,b=13echo "<br>";
$b=--$a;echo "a=".$a." ,b=".$b; //prints a=13 ,b=13echo "<br>";
$b=$a--;echo "a=".$a." ,b=".$b; //prints a=12 ,b=13echo "<br>";
?>
 
Output :

a=13 ,b=13a=14 ,b=13a=13 ,b=13a=12 ,b=13


String Operators


String operators are used for string concatenation and assign value to string.

' . ' and '.= ' operators are used.

operator syntax operation
. $a.$b concatenated $a and $b
.= $a.=$b It concatenated and then assign as $a = $a.$b

Conditional And Ternary Operators


Conditional Operators are used to compare the values.

It works as a if-else statement.

Ternary operator is ?: 

Syntax :

$var = (condition)? $a : $b ;





Mesothelioma Survival Rates , Mesothelioma Attorneys California , Seattle Mesothelioma Lawyer , Mesothelioma Suit , Mesothelioma Claim , Wisconsin Mesothelioma Attorney , Mesothelioma Attorney illinois , Mesothelioma Trial Attorney ,Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , New York Mesothelioma Law Firm,Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyers San Diego,Mesothelioma Litigation , Mesothelioma Attorney Assistance , Mesothelioma Lawyer Asbestos Cancer Lawsuit , Mesothelioma Lawyer Chicago , New York Mesothelioma Law Firm , 


Houston Mesothelioma Attorney , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , Lawsuit Mesothelioma  , Truck Accident Attorney Los Angeles ,Asbestos Exposure Lawyers  , Mesothelioma Cases  , Emergency Response Plan ppt , Mesothelioma Lawyers San Diego  , Asbestos Mesothelioma Lawsuit  , Tennessee Mesothelioma Lawyer , Meso Lawyer  , Mesothelioma Settlements Amounts  , Mesothelioma Law Firms , New Mexico Mesothelioma Lawyer , Accident Attorneys Orange County , Mesothelioma Lawsuit ,Personal Injury Accident Lawyer  , Purchase Structured Settlements  , Firm Law Mesothelioma , Car Accident Lawyers Los Angeles , Mesothelioma Attorneys , Structured Settlement Company  , Auto Accident Lawyer San Francisco  , Mesotheolima  , Los Angeles Motorcycle Accident Lawyer


Mesothelioma , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois , Mesothelioma Drug , Mesothelioma Attorney DirectoryMesothelioma Settlements , Mesothelioma Help  , Mesothelioma ct , Mesothelioma Attorney Florida , Washington Mesothelioma Attorney , Best Mesothelioma Lawyers , Diagnosed With Mesothelioma , Mesothelioma Settlement Amounts , Mesothelioma Personal Injury Lawyers , Mesothelioma Compensation , Attorney Lawyer Mesothelioma  ,Colorado Mesothelioma Lawyers,Mesothelioma Lawsuits , Mesothelioma Claims , Average Mesothelioma Settlement , Average Mesothelioma Settlement , Mesothelioma Law Suit , Alabama Mesothelioma Lawyer , alabama Mesothelioma Lawyer , utah mesothelioma lawyer , Dallas Mesothelioma Lawyer , Mesothelioma Attorney California , Mesothelioma Lawyer California ,Mesothelioma Survival Rates ,

Mesothelioma Attorneys California, Wisconsin Mesothelioma Attorney Mesotheliama , Mesothelioma Lawyer Virginia , Seattle Mesothelioma Lawyer , Mesothelioma Attorney illinois, Mesothelioma Trial Attorney Injury Lawyer Houston tx , Baltimore Mesothelioma Attorneys , Mesothelioma Care ,Mesothelioma Trial Attorney ,Mesothelioma Lawyer Texas , Mesothelioma Lawyer Dallas , Mesothelioma Care , Mesothelioma Trial Attorney , Mesothelioma Lawyer Texas , California Mesothelioma Attorney Philadelphia Mesothelioma Lawyer , Illinois Mesothelioma Lawyer , Mesothelioma Attorney , Mesothelioma Claims , Average Mesothelioma Settlement 
Integrated ehr , Mesothelioma Law Sui , Mesothelioma Lawyer California,Mesothelioma Attorney California ,Mesothelioma Law Suits ,Dallas Mesothelioma Attorneys ,Mesothelioma Drug ,Mesothelioma Attorney Directory