Re: Should I care about these errors?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
At 11:50 PM +1000 11/5/09, Angus Mann wrote:
OK...point taken.

On a partly related matter, which of the following is "correct" or "Better" ?

echo("Stuff to display...");
or
echo 'Stuff to display...';
or
echo "Stuff to display...";
or
echo('Stuff to display...');


I use:

    echo('Stuff to display...');

First, it easy for me to read. Second, the processor doe not evaluate the contents.

However,

    echo 'Stuff to display...';

is probably the more "purest" route. You don't need the parenthesis.

If you have a variable in the mix, then use double quotes, such as:

    echo("Stuff to display... $stuff");


This is really a personal preference. The same issue arises with the use of require, require_once, include, and include_once. None of these are functions (just like echo) and so they do not need the parenthesis. That said... for eacho I prefer to leave the parenthesis off since it makes formatting of text more convenient. However for require, include, etc... I usually add parenthesis so that it looks like a function :)

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux