
November 7th, 2002, 09:40 AM
|
|
Junior Member
|
|
Join Date: Nov 2002
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Arrays - undefined offset warning
Can anyone tell me why the running the following code produces an 'undefined offset error'':
<?php
function emailsyntax_is_valid($email) {
// ERROR IS CAUSED BY THE FOLLOWING LINE:
list($local, $domain) = explode("@", $email);
$pattern_local = '^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)$';
$pattern_domain = '^([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$';
$match_local = eregi($pattern_local, $local);
$match_domain = eregi($pattern_domain, $domain);
if ($match_local && $match_domain) {
return 1;
} else {
return 0;
}
}
?>
|