Re: A Few Noob Questions [message #175131 is a reply to message #175127] |
Tue, 16 August 2011 16:03 |
Tim Streater
Messages: 328 Registered: September 2010
Karma:
|
Senior Member |
|
|
In article <3Ev2q.149930$AU4(dot)73655(at)en-nntp-07(dot)dc1(dot)easynews(dot)com>,
"eBob.com" <eBob(dot)com(at)totallybogus(dot)com> wrote:
> Is "script" official terminology in PHP? The book I am reading says
> "Built-in superglobal variables are visible everywhere within a script." but
> has never explicitly defined "script". (Although there is a hint that maybe
> everything between tags is a script.)
>
> How can the "units" of PHP between tags communicate? Can my PHP code create
> $GLOBALS variables? How about $_SESSION variables?
Are you talking about a file that might contain a number of <?php ?> tag
pairs?
> The book gives the following example of a ternary operator:
>
> ($grade >= 50 ? 'Passed" : "Failed")
>
> I don't understand the function of the enclosing parentheses. The official
> doc at php.net doesn't seem to suggest that the parentheses are necessary.
I can't remember if this is actually the case but it probably has to do
with operator precedence. If you put parens around it then you know it
will be executed as a unit. Otherwise you may find that when you combine
it with other expressions execution does not proceed as you expect. It
may also make things clearer to you the reader, even if strictly they
are not necessary.
> Just to make sure, "@" only suppresses MESSAGES. It does not interfere with
> try/catch logic/code. Right?
Right.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
|
|
|