PHP Tutorials

How to Stay on Same Page after Submit in PHP 0

How to Stay on Same Page after Submit in PHP

Program 1 <html> <head><title>User Login Application</title> <body> <center> <form method=post action=userlogin.php> <table border=1> <tr> <th>User Name: </th> <td><input type=text name=txtuser></td> </tr> <tr> <th>Password: </th> <td><input type=password name=txtpass></td> </tr> <tr> <td></td> <td><input type=submit value=Submit name=submitbtn></td>...

PHP Include and Require 0

PHP Include and Require

Program 1 <html> <head><title>PHP For Loops</title> <body> <center> <?php // function add($a,$b,$c) // { // $d=$a+$b+$c; // echo “<br>Addition is: “.$d; // } function factorial($n) // Parameter { $f=1; while($n!=0) { $f=$f*$n; $n–; }...

PHP Math Functions Part – 1 0

PHP Math Functions Part – 1

Program 1 <html> <head><title>Math Function in PHP Application</title> <body> <pre> <center> <?php // $myar1=[89,5,80]; // $myar2=[56,15,20]; // $myar3=min($myar1,$myar2); // print_r($myar3); //$m=min(20,56,78,12,77,99,34); // $n=212; // $m=$n; // $s=0; // while($n!=0) // { // $r=$n%10; //...

PHP trim() Function with Example 0

PHP trim() Function with Example

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php $mystr=”Data Flair PHP Course “; $mystr1=”Free Course”; $mystr=chop($mystr); echo $mystr; echo $mystr1; //trim() //ltrim() // rtrim() //chop() ?> </pre> </center> </body> </html>  

PHP str_pad() Function with Examples 0

PHP str_pad() Function with Examples

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php $mystr=”Data Flair”; $mystr1=str_repeat($mystr,5); echo $mystr1.”<br>”; // $newstr1=str_pad($mystr,20,’.’,STR_PAD_LEFT); // $newstr2=str_pad($mystr,20,’.’,STR_PAD_BOTH); // $newstr3=str_pad($mystr,20,’.’,STR_PAD_RIGHT); // echo $newstr1.”<br>”; // echo $newstr2.”<br>”; // echo $newstr3.”<br>”; ?> </pre> </center>...

PHP String strrev() and str_shuffle() Function 0

PHP String strrev() and str_shuffle() Function

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php // $mystr=”ravi”; // //echo $mystr.”<br>”; // $newstr=strrev($mystr); // if(strcasecmp($mystr,$newstr)==0) // echo “String is palindrome”; // else // echo “String is not palindrome”; //...

PHP String str_replace() Function 0

PHP String str_replace() Function

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php // $myname=[“vivek”,”rajesh”,”dipesh”,”vikas”,”ravi”,”vikas”]; // print_r($myname); // $newname=str_replace(“vikas”,”kapil”,$myname); // print_r($newname); //$mystr=”Data Flair free php course with free Data Flair php course certificate”; // $a=[“php”,”course”]; //...

PHP strpos() Function with Examples 0

PHP strpos() Function with Examples

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php // $mystr=”Data flair Free php course with free notes with Free certificate FREE code”; // //$n=strpos($mystr,”free”,13); // // $n=strrpos($mystr,”free”); // //$n=stripos($mystr,”free”); // $n=strripos($mystr,”free”);...

PHP strncasecmp() Function with Examples 0

PHP strncasecmp() Function with Examples

Program 1 <html> <head><title>String in PHP Application</title> <body> <pre> <center> <?php $s1=”flair”; $s2=”data”; echo similar_text($s1,$s2); // $s1=”data flair free course”; // $s2=”Data base system”; // //if(strncmp($s1,$s2,6)==0) // if(strncasecmp($s1,$s2,4)==0) // echo “<font color=green size=5>Same</font>”; //...