a function question
| From: | Patrick Roane | Date: | Thu, 30 Dec 2004 05:06:43 +0000 |
| Subject: | a function question | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-25204@lists.php.net to get a copy of this message | ||
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@yahoo.com";
$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