On Thu, 2005-10-27 at 00:00 +0200, Jochem Maas wrote: > gonna jump on your thread there Jasper, I would > like to comment on your function and ask you a question: > > which is 'better' (for what), preg_*() or ereg[i]*()? I prefer preg_*(), but I used eregi() because I couldn't be bothered figuring out his regexp (it looked right, and it worked) and that's what he used :) It's a matter of personal taste, mainly. [snip] > > <?php > > function fix_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}$", > > this string concatenation looks a bit naff. > although on second thoughts I can see why you did it this way. > down to personal choice :-). I don't like it either, but that bit already worked, so I left it functionally as-is, and I had to make it shorter so as to not wrap stupidly in the email. > the use of double quotes means strictly speaking > you should be escaping the backslash and dollar sign (and the > parentheseses?) although i would recommend single quotes. Agreed. > I would have used preg_match(), something like [snip] So would I, if I had been writing the function from scratch. > white space is nice but too many blank lines lead to overscroll ;-) Another matter of personal taste. I love whitespace and my scroll wheel has its acceleration turned up very high, so scrolling doesn't really bother me :) -- Jasper Bryant-Greene General Manager Album Limited e: jasper@xxxxxxxxxxx w: http://www.album.co.nz/ b: http://jbg.name/ p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303 a: PO Box 579, Christchurch 8015, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php