At 23:53 14.11.2002, Lars Espelid said:
--------------------[snip]--------------------
>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";
>
>I get: HELLO 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
    ^     http://www.vogelsinger.at/



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

Reply via email to