Re: regex and global vars problem
| From: | Jason Gerfen | Date: | Wed, 26 Oct 2005 18:24:22 +0000 |
| Subject: | Re: regex and global vars problem | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224692@lists.php.net to get a copy of this message | ||
The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fix_mac() function nothing is being returned.
I am not recieving any error codes, just an empty var.
Sample output:
00aa11bb22cc converted to
00-aa-11-bb-22-cc converted to
00:aa:11:bb:22:cc is valid.
As you can see $mac3 is a valid example of a h/w address where $mac1 & $mac2 were returned from the fix_mac() function as an empty string.
Jasper Bryant-Greene wrote:
On Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote:-- Jason Gerfen "My girlfriend threated to leave me if I went boarding... I will miss her." ~ DIATRIBE aka FBITKKUm I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a ":" separating every two characters it then passes the var to the fix_mac() function which attempts to fix the string or h/w address by either replacing any "-" with a ":" or to break the h/w address up and insert a ":" every two characters. I also believe this is the one you should be playing with as the last post I added a new regex which wasn't working.OK, you've told us what your code does. Now can you explain what the problem is? "A new regex which wasn't working" is a bit vague. * Does it throw an error? - If so, can we have the error message? * Does it mark invalid strings as valid? - Or vice versa? Just posting a pile of code with an explanation of what it does and leaving the rest of us to figure out what the problem is, is not helping us to help you.