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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bakertaylor28
    New Member
    • Feb 2021
    • 45

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

    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.

    Code:
    <?php
    
    function validate_email($email){
    
       $exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$";
    
       if(eregi($exp,$email)){
    
          if(checkdnsrr(array_pop(explode("@",$email)),"MX")){
            return true;
          }else{
            return false;
          }
    
       }else{
    
          return false;
    
       }    
    }
    
    ?>
Working...