RE: [PHP-WIN] Problem escaping characters
| From: | Dash McElroy | Date: | Thu, 14 Nov 2002 23:46:19 +0000 |
| Subject: | RE: [PHP-WIN] Problem escaping characters | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-16955@lists.php.net to get a copy of this message | ||
Lars,
Looks like you have an error in your syntax on the ereg line. It should most
likely look like this:
if (ereg([^0-9], $num)) {
print "That's not a number!";
}
And your second thing is not a failure of PHP, it's a "feature" of web
browsers reading stuff in HTML. Try either wrapping it in <pre> tags or put
a <br> before the \n, or use nl2br() (www.php.net/nl2br). If you viewed your
source in the browser, you'd find this:
HELLO
WORLD
-Dash
-----Original Message-----
From: Lars Espelid [mailto:lars_espelid@hotmail.com]
Sent: Thursday, November 14, 2002 2:56 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Problem escaping characters
Hello,
I'm running Apache 1.3.26, PHP 4.0.5 and WinXPpro.
My problem is as follows:
Try to execute this code:
if (ereg[^0-9], $num))
print "That's not a number!";
result: parsing error, expects ')' on the if-line.
Have also tried other expressions where I escape characters. They won't
work.
When I write:
echo "HELLO \n";
echo "WORLD";
I get: HELLO WORLD
(on one line!?)
Anyone know what's wrong? Do I need to install an extension?
Bottom of my httpd.conf:
LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Thanks,
Lars
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php