i have few question regarding the return statement.
a) is it compulsory to define a return statement in a user defined function.?
b) is it still valid if i just define a return statement without any parameter? will it return the null value?
c) is the following function valid?
function admin_credential($password = 0, $email = 0) {
     if( $password != 0) {
         $password = sha1($password);
         $query = "UPDATE admins SET password = '$password'";
         $result = mysql_query($query);
         }
     if( $email != 0) {
         $query = "UPDATE admins SET email = '$email'";
         $result = mysql_query($query);            
         }
         return;
         }
                a) is it compulsory to define a return statement in a user defined function.?
No.
b) is it still valid if i just define a return statement without any parameter? will it return the null value?
Yes.
c) is the following function valid?
Yes, but $result will be lost because you are not returning it. The  return is not really necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With