472,126 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

How do we call a function with parameters and use output returning true/false in php?

45 32bit
How do we use something like the following? I can't seem to find anything practical on how to use the true/false return or on how to supply parameters to a function.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. function validate_email($email){
  4.  
  5.    $exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$";
  6.  
  7.    if(eregi($exp,$email)){
  8.  
  9.       if(checkdnsrr(array_pop(explode("@",$email)),"MX")){
  10.         return true;
  11.       }else{
  12.         return false;
  13.       }
  14.  
  15.    }else{
  16.  
  17.       return false;
  18.  
  19.    }    
  20. }
  21.  
  22. ?>
  23.  
4 Weeks Ago #1
0 6610

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

35 posts views Thread by Steven Bethard | last post: by
7 posts views Thread by Bill Reed via AccessMonster.com | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.