You're simply missing quotation marks, as far as I can see:

if (ereg('[^0-9]', "2002-11-14"))
    print "That's not a number!";


Marco
-- 
------------
php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!
--- Begin Message ---
Hello,

I'm running Apache/1.3.26 and PHP 4.0.5 on WinXP pro.

The following code is taken from the book mastering PHP 4.1 and is supposed
to work:

if (ereg([^0-9], "2002-11-14"))
    print "That's not a number!";

It won't work for me. I get a parse error expecting a ')'.

I have also tried other regular expressions, but almost all of them fails.
One that works: if (ereg("....-..-..", "2002-11-14"))

Also  '\n' in an echo-expression won't work. It is ignored.
code:
echo "HELLO \n";
echo "WORLD";

result:
HELLO WORLD

What can be wrong? Do I miss a library or something??

Thanks,

Lars




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to