Hello,

Lars Espelid wrote:
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 ')'.
Is this the only code on the page? Try quoting your expression, and bracketing your if check i.e.
if ( ereg ( "[^0-9]", "2002-11-14" ) ) {
print "That's not a number!";
}

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 did you expect this to do? Most, if not all browsers don't start a new line when they encounter a new line or carrige return unless it's encased by <pre></pre> tags. Try this...

echo "HELLO<br>\n";
echo "WORLD";


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

Thanks,

Lars





--
By-Tor.com
It's all about the Rush
http://www.by-tor.com


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

Reply via email to