Posts

Showing posts from April 1, 2020

Write a PHP Program to send a mail from php Script

Write a PHP Program to send a mail from php Script <!DOCTYPE html> <html> <head>           <title>Practical-10</title> </head> <body> <?php error_reporting(0); $to="me@localhost"; $subject="This is Subject Subject"; $message="<b>This is PHP message.</b>"; $message="<h1>This is Headline.</h1>"; $header="Fom:abc@somedomain.com \r\n"; $header="Cc:afgh@somedomain.com \r\n"; $header.="MIME-Version:1.0\r\n"; $header.="Content-type: text/html\r\n"; $retval=mail($to,$subject,$message,$header); if($retval==false) {           echo "Message Sent Successfully....."; } else {           echo "Message could not be sent....."; } ?> </body> </html> OUTPUT:- Message Sent Successfully.....

Write a PHP Program to recursive traversals of directory.

Write a PHP Program to recursive traversals of directory. <?php /* error_reporting (E_All |E_STRICT); ini_set('display_errors',1); */ header('Content-Type: text/plain'); $dir=dirname(__FIlE__); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir))as $item) {           if($item->isFile()|| $item->isDir())           {                    echo $item.PHP_EOL;           } } ?> OUTPUT:- C:\xampp\htdocs\php practicle2020\. C:\xampp\htdocs\php practicle2020\.. C:\xampp\htdocs\php practicle2020\practical10.php C:\xampp\htdocs\php practicle2020\practical12.php C:\xampp\htdocs\php practicle2020\practical2.php C:\xampp\htdocs\php practicle2020\practical3.php C:\xampp\htdocs\php practicle2020\practical4.php C:\xampp\htdocs\php practicle2020\practical5.php C:\xampp\htdocs\php practicle2020\practical6.php C:\xampp\htdocs\php practicle2020\practicle1.php

Write a PHP Program to generate the multiplication of matrix.

Write a PHP Program to generate the multiplication of matrix. <?php $p=array(); $p[]=array(1,3,-4); $p[]=array(1,1,-2); $p[]=array(-1,-2,5); $q=array(); $q[]=array(8,3,0); $q[]=array(3,10,2); $q[]=array(0,2,6); echo"matrix 1<br/>"; echoMatrix(3,$p); echo"<br/>"; echo"matrix 2<br/>"; echoMatrix(3,$q); echo"<br/>"; $r=matrixMultiply(3,$p,$q); echo"result of matrix multiply<br/>"; echoMatrix(3,$r); function echoMatrix($N,$r) {           for($i=0;$i<$N;$i++)           {                    for($j=0;$j<=$N;$j++)                    {                              if($j==$N)                              {                                       echo"<br>";                              }                              else                              {                                       echo $r[$i][$j];              

Write a PHP Program to display the today’s date and Current time.

Write a PHP Program to display the today’s date and Current time. <!DOCTYPE html> <html> <head>           <title>Practical-2</title> </head> <body> <?php print strftime('%c'); echo"</br>"; print strftime('%d/%m/%Y'); echo "</br>"; print strftime('%A,%d,%B-%Y'); echo "</br>"; echo "<b>Current Day,Date And Time is:</b>".date("D M d,Y G:i A"); ?> </body> </html> OUTPUT:- 02/04/20 06:53:54 04/02/2020 Tuesday,04,February-2020 Current Day,Date And Time is: Tue Feb 04,2020 6:53 AM

Write a PHP Program to display the Fibonacci series.

Write a PHP Program to display the Fibonacci series. <!DOCTYPE html> <html> <head>           <title>Practicle-3</title> </head> <body> <?php $count=0; $no1=0; $no2=1; $tot=0; while($count<=10) {           echo $tot."</br>";           $no1=$no2;           $no2=$tot;           $tot=$no1+$no2;           $count++; } ?> </body> </html> OUTPUT:- 0 1 1 2 3 5 8 13 21 34 55

Write a PHP Program to demonstrate the use of Array.

Write a PHP Program to demonstrate the use of Array. <?php /*indexed array*/ //index array using method-1 $gm=array("BCA","PGDCA","MSCIT"); echo"I like".$gm[0].",".$gm[1]."and".$gm[2]."."; echo"<br>"; //Indexed Array using Method-2 $gm[0]="<b>BCA</b>"; $gm[1]="<b>PGDCA</b>"; $gm[2]="<b>MSCIT</b>"; echo"I like".$gm[0].",".$gm[1]."and".$gm[2]."."; echo"<br>elements in array:"; $arrsize=count($gm); for($cnt=0;$cnt<$arrsize;$cnt++) { echo "<br>"; echo "<br>".$gm[$cnt]."</br>"; } echo "<br>"; /*Associative Array*/ //Associative Array using Method-1 $gm=array("d1"=>"BCA","d2"=>"PGDCA","d3"=>"MSCIT&qu

Write a PHP Program to calculate sum of given number

Write a PHP Program to calculate sum of given number. <!DOCTYPE html> <html> <head>         <title>Practical-4</title> </head> <body> <?php $val1=10; $val2=10; function sum($val1,$val2) {         $total=$val1+$val2;         return $total; } echo "<b>Sum Using Function:</b>".sum($val1,$val2); $sum=$val1+$val2; echo "</br>"; echo "<b>Sum is :</b>$sum"; ?> </body> </html> OUTPUT:- Sum Using Function: 20 Sum is : 20

Write a PHP Program to read the employee details using form component.

Image
Write a PHP Program   to read the employee details using form component. <html> <head> <title>Employee Form</title> </head> <body> <form name="empfrmdemo"action="practical6a.php"method="post"> <fieldset> <legend>Grow More Computer Science </legend> <table width="360px"border="2"align="center"> <caption><b>Enter Employee detail</b></caption> <tr><td> <align="right">Employee Name</td> <td> <input type="text"name="empname"size="30px"></td> </tr> <tr> <td> <align="right">Address</td> <td><textarea name="empadd"cols="23"></textarea></td> </tr>           <td align="right">Department</td>           <td&g