Tuesday, January 21, 2014

Write last 6 PHP Programs for File

<?php

    $email="example@gmail.com";
    echo "Domain: ". strstr($email,"@");
    echo "<br>Username :". strstr($email,"@",true);
?>

   
NEXT PROGRAM :
 

<?php
    
    $mobile ="+91723456789";
    echo "<br>C Code :". substr($mobile,0,3);
    echo "<br>M No :". substr($mobile,3);
?>


   
NEXT PROGRAM :
 
<?php
    
    $string ="mam";
   
    echo "<br>Reverse :".strrev($string);
   
    if ($string == strrev($string))
        echo "<br> Palindrom ";
    else
        echo "<br> Not Palindrom ";

?>   
 

NEXT PROGRAM : 
<?php
    
    $i;
    echo "<table>";
    for($i=65;$i<120;$i++)
    {
        echo "<tr><td>".chr($i)."</td><td>".$i."</td></tr>";
    }
   
    echo "</table>";
?>   

 

NEXT PROGRAM : 
<?php
    
    $cnt = "India";
    $cntx = "dia";
   
    $a=strlen($cnt);
    $b=strlen($cntx);
   
    $ans = substr($cnt,-$b,$a);
    echo "<br> Ans :".$ans;
   
    if ($ans == $cntx)
        echo "<br>Match Found !";
    else
        echo "<br> not found!";

?>       
 

NEXT PROGRAM : 
<?php
    
    $newx = rand(001,120);
   
    echo "<br>12BCA".str_pad($newx,3,"0",STR_PAD_LEFT);

?>

No comments:

Post a Comment