RE: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-11 Thread Ford, Mike [LSS]
On 11 February 2004 00:38, Adam Bregenzer contributed these pearls of
wisdom:

 On Tue, 2004-02-10 at 19:06, Richard Davey wrote:
 This is slightly off-topic, but related to the include()
 function. What is the given standard regarding when you
 should or shouldn't use braces on a function.
 
 [snip]
 
 Both work just fine. The manual includes examples of both
 methods. So which do most people consider the right way ?
 
 I always use parens on function calls, I think it is more
 readable. Also, some syntax highlighters look for it.

So you don't use parens on include?  (Because it's a language construct and
not a function ;)

That's my take on it -- for language constructs such as include, require,
echo, return, which don't require parentheses, I leave them off.  Including
the parens make them look like functions and, as a general rule, they don't
behave like functions, so the parens are misleading.

Mind you, there are exceptions: exit(), for example, is a language construct
but requires the parens (at least, that's what the fine manual appears to
say, and I've not tested it without!).

Cheers!

Mike

-- 
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



Re: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-11 Thread John W. Holmes
From: Ford, Mike [LSS] [EMAIL PROTECTED]

 Mind you, there are exceptions: exit(), for example, is a language
construct
 but requires the parens (at least, that's what the fine manual appears to
 say, and I've not tested it without!).

Only if you want to pass an exit value, i.e. exit(101); otherwise just plain
'ole exit; works fine.

---John Holmes...

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



Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Richard Davey
Hello John,

Tuesday, February 10, 2004, 8:20:50 PM, you wrote:

JWH include($_CONF['path'] . '/test.php');

This is slightly off-topic, but related to the include() function.
What is the given standard regarding when you should or shouldn't
use braces on a function.

For example:

include $dir/file.php

vs.

include($dir/file.php)

Both work just fine. The manual includes examples of both methods. So
which do most people consider the right way ?

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



RE: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Martin Towell
 Hello John,
 
 Tuesday, February 10, 2004, 8:20:50 PM, you wrote:
 
 JWH include($_CONF['path'] . '/test.php');
 
 This is slightly off-topic, but related to the include() function.
 What is the given standard regarding when you should or shouldn't
 use braces on a function.
 
 For example:
 
 include $dir/file.php
 
 vs.
 
 include($dir/file.php)
 
 Both work just fine. The manual includes examples of both methods. So
 which do most people consider the right way ?

This is one of those personal preference things. Pick which ever way you
like the best and stick with it.

Martin

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



Re: Re[2]: [PHP] HELP: Nested include(...)'s take relative paths not intuitively

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 19:06, Richard Davey wrote:
 This is slightly off-topic, but related to the include() function.
 What is the given standard regarding when you should or shouldn't
 use braces on a function.

[snip]

 Both work just fine. The manual includes examples of both methods. So
 which do most people consider the right way ?

I always use parens on function calls, I think it is more readable. 
Also, some syntax highlighters look for it.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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