At 23:53 14.11.2002, Lars Espelid said:
>Try to execute this code:
>if (ereg[^0-9], $num))
>    print "That's not a number!";
>result: parsing error, expects ')' on the if-line.

You forgot an opening bracket, and need to quote the regex, like
    if (ereg('[^0-9]', $num))
        print "That's not a number!";

>When I write:
>echo "HELLO \n";
>echo "WORLD";
>(on one line!?)

You need to tell the browser to create a newline when displaying HTML:
    echo "HELLO<br>WORLD"
will look identical to
    echo "HELLO<br>\nWORLD"

You can also use the nl2br() function to convert all newlines to a line break:
    echo nl2br("HELLO\nWORLD");

If you display preformatted text you'll see the linebreak:
    echo "<pre>HELLO\nWORLD</pre>";

   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to