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");
        //   echo $n;
          $email="[email protected]";
           $p=strpos($email,"@");  
            if($p>0)
             {
                  $p1=strpos($email,".",$p+1);
                  if($p1>0)
                   echo "<font color=green size=5>Valid email id</font>";
                  else
                   echo "<font color=red size=5>Invalid email id</font>";
             } 
             else
             echo "<font color=red size=5>Invalid email id</font>";
          
//strpos()
//strrpos()
//stripos()
//strripos()      
?>

</pre>
        </center>
</body>
</html>

 

courses

Leave a Reply

Your email address will not be published. Required fields are marked *