Posted by Jason Wong on 01/21/05 18:22
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
Navigation:
[Reply to this message]
|