PHP Tutorials

PHP String Concatenation 0

PHP String Concatenation

Program 1 <html> <head><title>String Operator in PHP</title> <body> <center> <?php // $a=50; // $b=30; // $c=$a+$b; // echo “Addtion of “.$a.” and “. $b. ” is “.$c $x=”Data”; $y=” Flair Free Course”; $x.=$y; echo...

Goto Statement in PHP 0

Goto Statement in PHP

Program 1 <html> <head><title> go to Statement in PHP Application</title> <body> <center> <?php for($i=1;$i<=10;$i++) { echo $i; if($i==5) goto xyz; echo “<br>”; } //$a=500; // if($a>100) // { // echo “First”; // echo “Second”;...

PHP Conditional Statements Part – 2 0

PHP Conditional Statements Part – 2

Program 1 <html> <head><title>PHP Condtional Operator Operators</title> <body> <center> <?php $n=2; // 1 to 5 if($n==1) echo ” One”; elseif($n==2) echo ” Two”; elseif($n==3) echo ” Three”; elseif($n==4) echo ” Four”; elseif($n==5) echo “...

PHP Conditional Statements Part – 1 0

PHP Conditional Statements Part – 1

Program 1 <html> <head><title>PHP Condtional Operator Operators</title> <body> <center> <?php $n=1; // 1 to 5 if($n==1) echo ” One”; if($n==2) echo ” Two”; if($n==3) echo ” Three”; if($n==4) echo ” Four”; if($n==5) echo “...

Increment and Decrement Operators in PHP 0

Increment and Decrement Operators in PHP

Program 1 <html> <head><title>PHP Relational Operators</title> <body> <center> <?php $a=20; //21 $b=10; //10 if(++$a<25 or ++$b>5) // Short circuit echo “Hello Data Flair”; else echo “Bye Bye “; echo “<br>”; echo “a= “.$a; echo...

Logical Operators in PHP 0

Logical Operators in PHP

Program 1 <html> <head><title>PHP Relational Operators</title> <body> <center> <?php $per=78; if($per<35) echo “Fail”; elseif($per>=35 && $per<45) echo “III Division”; elseif($per>=45 && $per<60) echo “II Division”; elseif($per>=60) echo “I Division”; $ch=’S’; // $a=0; // $b=100;...

Type Casting in PHP 0

Type Casting in PHP

Program 1 <!DOCTYPE> <html> <body> <center> <?php // $a=’120′;// String // echo”<br>Before type casting: “; // var_dump($a); // $a=(int)($a); //int // echo”<br>After type casting: “; // var_dump($a); // $a=123.55; // echo”<br>Before type casting: “;...

Relational Operators in PHP 0

Relational Operators in PHP

Program 1 <html> <head><title>PHP Relational Operators</title> <body> <center> <?php $a=50; $b=0; $c=20; var_dump($a && $b); // var_dump($b===$c) // var_dump($c<=>$a) //var_dump($a<=>$b); // when a is > then b +1 //var_dump($a<=>$b); // when a is ==...

Types of Operators in PHP 0

Types of Operators in PHP

Program 1 <html> <head><title>My First PHP Application</title> <body> <center> <?php $a=30; $b=10; // echo($a + $b);// 40 // echo “<br>”; // echo($a – $b);/20 // echo “<br>”; // echo($a * $b);//300 // echo “<br>”;...