Re: regular expression help

From: Date: Fri, 21 Jan 2005 16:22:54 +0000
Subject: Re: regular expression help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206948@lists.php.net to get a copy of this message
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

« previous php.general (#206948) next »