You are here: Re: [PHP] regular expression help « PHP « IT news, forums, messages
Re: [PHP] regular expression help

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация