a function question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to create a function that works with two
arguments. the 1st needs to be a suername. The 2nd
needs to be an email address. Next, I have to use case
conversion functions to capitalize the first letter of
the username and convert the email add. to lowercase
characters and finaly check that it contains the @
sign. If I can't find the @ character, return false:
otherwise, I return an array containing the converted
arguments.

Here is my code (which I can't get to work):

<?php


        $mail = "FOJOMO@xxxxxxxxx";
	$user = "patrick";  
     
	function usermail( $user, $mail ) {
        
	global $user; 
        global $mail; 

        $user; = ucwords( $user ); // capitalizes the 
    //'p' in patrick
        $mail; = strtolower( $mail ); // converts all
//of FOJOMO into lower case
		
		

  if ( strstr( $mail ), "@" )) {                      
    // searches for the '@' sign
  user_array = explode("-", $user, $mail); // this
//function (explode) creates the array
			} else {
	print "Please enter a valid e-mail address";   //
default if test fails to //find the '@' sign 
				
	
	}

				
		
?>

=====

----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied"

  ~ Lynard Skynard

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux