Re: regular expression help

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

 



On Saturday 22 January 2005 00:12, Jason wrote:
> Simple functions to check & fix if necessary invalid formating of a MAC
> address... I seem to be having problems with the global variable $mac
> not being returned from the fix_mac() function.  Any help is appreciated.

Your subject says "regular expression help" but your problem is "with the 
global variable $mac ...". So which is it? If you're going to declare a 
variable as 'global' then it has to be done in every function in which that 
variable is to be used.

Which means here:

> function chk_mac( $mac ) {
>   if( eregi(
> "^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-
>f]{2}\:[0-9A-Fa-f]{2}$", $mac ) ) {
>    return 0;
>   } else {
>    return 1;
>   }
> }

and wherever else.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux