Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2834 > unrolled thread
| Started by | "eBob.com" <eBob.com@totallybogus.com> |
|---|---|
| First post | 2011-08-16 11:02 -0400 |
| Last post | 2011-08-18 10:12 -0400 |
| Articles | 20 on this page of 27 — 9 participants |
Back to article view | Back to comp.lang.php
A Few Noob Questions "eBob.com" <eBob.com@totallybogus.com> - 2011-08-16 11:02 -0400
Re: A Few Noob Questions A.Reader <anonymously@example.com> - 2011-08-16 11:11 -0400
Re: A Few Noob Questions The Natural Philosopher <tnp@invalid.invalid> - 2011-08-16 16:35 +0100
Re: A Few Noob Questions Tim Streater <timstreater@greenbee.net> - 2011-08-16 17:03 +0100
Re: A Few Noob Questions Man-wai Chang <toylet.toylet@gmail.com> - 2011-08-17 00:35 +0800
Re: A Few Noob Questions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-08-16 19:24 +0200
Re: A Few Noob Questions The Natural Philosopher <tnp@invalid.invalid> - 2011-08-16 23:58 +0100
Re: A Few Noob Questions Man-wai Chang <toylet.toylet@gmail.com> - 2011-08-19 00:41 +0800
Re: A Few Noob Questions The Natural Philosopher <tnp@invalid.invalid> - 2011-08-18 18:33 +0100
Re: A Few Noob Questions Tim Streater <timstreater@greenbee.net> - 2011-08-18 18:39 +0100
Re: A Few Noob Questions The Natural Philosopher <tnp@invalid.invalid> - 2011-08-18 19:09 +0100
Re: A Few Noob Questions Man-wai Chang <toylet.toylet@gmail.com> - 2011-08-19 00:40 +0800
Re: A Few Noob Questions The Natural Philosopher <tnp@invalid.invalid> - 2011-08-18 18:26 +0100
Re: A Few Noob Questions A.Reader <anonymously@example.com> - 2011-08-18 13:44 -0400
Re: A Few Noob Questions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-08-20 19:48 +0200
Re: A Few Noob Questions Samuel Smythe <s.smythe@yahoo.com> - 2011-08-20 15:08 -0400
Re: A Few Noob Questions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-08-20 23:31 +0200
Re: A Few Noob Questions Samuel Smythe <s.smythe@yahoo.com> - 2011-08-20 18:37 -0400
Re: A Few Noob Questions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-08-21 00:41 +0200
Re: A Few Noob Questions Samuel Smythe <s.smythe@yahoo.com> - 2011-08-20 19:04 -0400
Re: A Few Noob Questions Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-20 21:44 -0400
Re: A Few Noob Questions Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-08-21 09:16 +0200
Re: A Few Noob Questions Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-20 15:52 -0400
Re: A Few Noob Questions Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-08-16 21:30 +0000
Re: A Few Noob Questions "eBob.com" <eBob.com@totallybogus.com> - 2011-08-16 20:31 -0400
Re: A Few Noob Questions A.Reader <anonymously@example.com> - 2011-08-17 05:50 -0400
Re: A Few Noob Questions "eBob.com" <eBob.com@totallybogus.com> - 2011-08-18 10:12 -0400
Page 1 of 2 [1] 2 Next page →
| From | "eBob.com" <eBob.com@totallybogus.com> |
|---|---|
| Date | 2011-08-16 11:02 -0400 |
| Subject | A Few Noob Questions |
| Message-ID | <3Ev2q.149930$AU4.73655@en-nntp-07.dc1.easynews.com> |
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? 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. Just to make sure, "@" only suppresses MESSAGES. It does not interfere with try/catch logic/code. Right? Thanks very much. Bob
[toc] | [next] | [standalone]
| From | A.Reader <anonymously@example.com> |
|---|---|
| Date | 2011-08-16 11:11 -0400 |
| Message-ID | <cn1l471qc3qp28mopk60v81g4krn9tqf0r@4ax.com> |
| In reply to | #2834 |
On Tue, 16 Aug 2011 11:02:40 -0400, "eBob.com" <eBob.com@totallybogus.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.) "Script" in this context is a synonym for "program". Some people seem to need to make things confusing by giving new names to old concepts. > >How can the "units" of PHP between tags communicate? Can my PHP code create >$GLOBALS variables? How about $_SESSION variables? You'll have to ask the question in a different way. > >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. The parens encapsulate the expression/statement, and prevent the compiler from getting confused. You'll see similar uses in other contexts. > >Just to make sure, "@" only suppresses MESSAGES. It does not interfere with >try/catch logic/code. Right? Right.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-08-16 16:35 +0100 |
| Message-ID | <j2e2na$6gl$1@news.albasani.net> |
| In reply to | #2836 |
A.Reader wrote: > On Tue, 16 Aug 2011 11:02:40 -0400, > "eBob.com" <eBob.com@totallybogus.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.) > > "Script" in this context is a synonym for "program". Some people > seem to need to make things confusing by giving new names to old > concepts. > Script tends to be or interpreted code, rather than compiled.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-08-16 17:03 +0100 |
| Message-ID | <timstreater-E14BF0.17031516082011@news.individual.net> |
| In reply to | #2834 |
In article <3Ev2q.149930$AU4.73655@en-nntp-07.dc1.easynews.com>, "eBob.com" <eBob.com@totallybogus.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
[toc] | [prev] | [next] | [standalone]
| From | Man-wai Chang <toylet.toylet@gmail.com> |
|---|---|
| Date | 2011-08-17 00:35 +0800 |
| Message-ID | <j2e682$m3j$3@dont-email.me> |
| In reply to | #2834 |
On 16/08/11 11:02 PM, eBob.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.) In the old days, "Programs" were compiled into binary codes for direct execution by the CPU. "Scripts" were not compiled, but interpreted by a program called intepreter. -- @~@ You have the right to remain silent. / v \ Simplicity is Beauty! /( _ )\ May the Force and farces be with you! ^ ^ (x86_64 Ubuntu 9.10) Linux 2.6.39.3 不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA): http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-08-16 19:24 +0200 |
| Message-ID | <8879571.SEqChMirdb@PointedEars.de> |
| In reply to | #2840 |
Man-wai Chang wrote: > On 16/08/11 11:02 PM, eBob.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.) > > In the old days, "Programs" were compiled into binary codes for direct > execution by the CPU. "Scripts" were not compiled, but interpreted by a > program called intepreter. Contrary to popular belief, scripts, i. e. programs written in a scripting language, are compiled, too. They are *JIT-compiled* *at runtime*. PHP 4+ scripts are compiled by the Zend Engine (a virtual machine, currently Zend Engine II), to Zend Opcode, a platform-independent byte code (much like with Java). That byte code is interpreted by that VM. See also: - <http://php.net/manual/en/internals2.opcodes.php> - <http://www.infoworld.com/d/developer-world/zend-hails-php-microsoft- ibm-733>. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-08-16 23:58 +0100 |
| Message-ID | <j2eslv$23c$1@news.albasani.net> |
| In reply to | #2843 |
Thomas 'PointedEars' Lahn wrote: > Man-wai Chang wrote: > >> On 16/08/11 11:02 PM, eBob.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.) >> In the old days, "Programs" were compiled into binary codes for direct >> execution by the CPU. "Scripts" were not compiled, but interpreted by a >> program called intepreter. > > Contrary to popular belief, scripts, i. e. programs written in a scripting > language, are compiled, too. They are *JIT-compiled* *at runtime*. > Contrary to popular belief, machine code is interpreted by the CPU's microcode, if you REALLY want to be pedantic.
[toc] | [prev] | [next] | [standalone]
| From | Man-wai Chang <toylet.toylet@gmail.com> |
|---|---|
| Date | 2011-08-19 00:41 +0800 |
| Message-ID | <j2jfcg$48l$2@dont-email.me> |
| In reply to | #2859 |
> Contrary to popular belief, machine code is interpreted by the CPU's > microcode, if you REALLY want to be pedantic. Could some experts here draw a tree diagram to explain all these? :)
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-08-18 18:33 +0100 |
| Message-ID | <j2jid2$mkm$1@news.albasani.net> |
| In reply to | #2874 |
Man-wai Chang wrote: >> Contrary to popular belief, machine code is interpreted by the CPU's >> microcode, if you REALLY want to be pedantic. > > Could some experts here draw a tree diagram to explain all these? :) No need PHP code is 'compiled' into an intermediate language which is interpreted by the zend engine which is written in (c? C++?) and so runs machine code on the processor, which takes the machine code like PUSH AX interprets it into machine code instructions like 'move this register onto the data bus a and put the contents of that other register on the address part of the bus, then issue a write memory bit pattern to the bus and increment this register' .
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-08-18 18:39 +0100 |
| Message-ID | <timstreater-4C83A9.18394218082011@news.individual.net> |
| In reply to | #2874 |
In article <j2jfcg$48l$2@dont-email.me>, Man-wai Chang <toylet.toylet@gmail.com> wrote: > > Contrary to popular belief, machine code is interpreted by the CPU's > > microcode, if you REALLY want to be pedantic. That's arguably true *if* the CPU *has* microcode. It may be implemented using random logic. > Could some experts here draw a tree diagram to explain all these? :) Google. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-08-18 19:09 +0100 |
| Message-ID | <j2jkhg$rb0$1@news.albasani.net> |
| In reply to | #2878 |
Tim Streater wrote: > In article <j2jfcg$48l$2@dont-email.me>, > Man-wai Chang <toylet.toylet@gmail.com> wrote: > >> > Contrary to popular belief, machine code is interpreted by the CPU's >> > microcode, if you REALLY want to be pedantic. > > That's arguably true *if* the CPU *has* microcode. It may be implemented > using random logic. > Most if not all CISC has *some* microcode. Not sure about ARM chips.. Mostly mnot it seems
[toc] | [prev] | [next] | [standalone]
| From | Man-wai Chang <toylet.toylet@gmail.com> |
|---|---|
| Date | 2011-08-19 00:40 +0800 |
| Message-ID | <j2jfa5$48l$1@dont-email.me> |
| In reply to | #2843 |
>> In the old days, "Programs" were compiled into binary codes for direct >> execution by the CPU. "Scripts" were not compiled, but interpreted by a >> program called intepreter. > > Contrary to popular belief, scripts, i. e. programs written in a scripting > language, are compiled, too. They are *JIT-compiled* *at runtime*. Is this real compilation? :) > PHP 4+ scripts are compiled by the Zend Engine (a virtual machine, currently > Zend Engine II), to Zend Opcode, a platform-independent byte code (much like > with Java). That byte code is interpreted by that VM. So is PHP still a script?
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-08-18 18:26 +0100 |
| Message-ID | <j2ji0u$lkg$1@news.albasani.net> |
| In reply to | #2873 |
Man-wai Chang wrote: >>> In the old days, "Programs" were compiled into binary codes for direct >>> execution by the CPU. "Scripts" were not compiled, but interpreted by a >>> program called intepreter. >> >> Contrary to popular belief, scripts, i. e. programs written in a >> scripting >> language, are compiled, too. They are *JIT-compiled* *at runtime*. > > Is this real compilation? :) > well its like pascal. Its compiled to an intermediate level interpreterd thing. >> PHP 4+ scripts are compiled by the Zend Engine (a virtual machine, >> currently >> Zend Engine II), to Zend Opcode, a platform-independent byte code >> (much like >> with Java). That byte code is interpreted by that VM. > > So is PHP still a script? who gives a damn?
[toc] | [prev] | [next] | [standalone]
| From | A.Reader <anonymously@example.com> |
|---|---|
| Date | 2011-08-18 13:44 -0400 |
| Message-ID | <eghq47ldpj06jh1mpqp97oefl6a38r33h0@4ax.com> |
| In reply to | #2873 |
On Fri, 19 Aug 2011 00:40:26 +0800, Man-wai Chang <toylet.toylet@gmail.com> wrote: >>> In the old days, "Programs" were compiled into binary codes for direct >>> execution by the CPU. "Scripts" were not compiled, but interpreted by a >>> program called intepreter. >> >> Contrary to popular belief, scripts, i. e. programs written in a scripting >> language, are compiled, too. They are *JIT-compiled* *at runtime*. > >Is this real compilation? :) How do you define "real compilation"? The principle of compilation, as of assembly, is translate once (because translation is slow and was costly), and ever after just run the product of the assembly/compilation process. So, given that definition, compiling to p(seudo)-code is just as much compilation as compiling to machine code. Only the execution environment is different: pcode runs on a pmachine, a virtual chip implemented in software rather than hardware and thus potentially able to be run on any hardware to which that pmachine has been ported. Machine code runs directly on the hardware -- but only the specific type of hardware for which it was written. Machine-code programs are fast, pcode programs are slower, source-interpreted programs are slowest. PHP, like Java, JavaScript, and quite a few other languages, compiles to pcode, and the programs run on a pmachine. > >> PHP 4+ scripts are compiled by the Zend Engine (a virtual machine, currently >> Zend Engine II), to Zend Opcode, a platform-independent byte code (much like >> with Java). That byte code is interpreted by that VM. > >So is PHP still a script? Of course you can call a php program a "script" if you like, but the traditional name for any coherent, task-oriented set of computer instructions, regardless of how or whether they are compiled, is "program". I've never seen the point of inventing new names for existing concepts; all it seems to do is add confusion. But some people profit from confusion, so I'm sure that explains at least part of it.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-08-20 19:48 +0200 |
| Message-ID | <1550652.qVoOGUtdWV@PointedEars.de> |
| In reply to | #2873 |
Man-wai Chang wrote: >>> In the old days, "Programs" were compiled into binary codes for direct >>> execution by the CPU. "Scripts" were not compiled, but interpreted by a >>> program called intepreter. >> >> Contrary to popular belief, scripts, i. e. programs written in a >> scripting language, are compiled, too. They are *JIT-compiled* *at >> runtime*. > > Is this real compilation? :) Yes. >> PHP 4+ scripts are compiled by the Zend Engine (a virtual machine, >> currently Zend Engine II), to Zend Opcode, a platform-independent byte >> code (much like >> with Java). That byte code is interpreted by that VM. > > So is PHP still a script? PHP is a scripting language. Scripting languages are a subset of programming languages. As a result, a PHP program may be called a PHP script. This is not an Internet chat, so please leave in the attribution lines. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | Samuel Smythe <s.smythe@yahoo.com> |
|---|---|
| Date | 2011-08-20 15:08 -0400 |
| Message-ID | <151za9v4szd5z$.68ezcs4m0dn$.dlg@40tude.net> |
| In reply to | #2915 |
On Sat, 20 Aug 2011 19:48:58, Thomas 'PointedEars' Lahn wrote: > This is not an Internet chat, so please leave in the attribution lines. He won't, any more than you'll fix your sig. -- Sig Heil!
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-08-20 23:31 +0200 |
| Message-ID | <1853589.8aWI4IWYNz@PointedEars.de> |
| In reply to | #2916 |
Samuel Smythe wrote: > On Sat, 20 Aug 2011 19:48:58, Thomas 'PointedEars' Lahn wrote: >> This is not an Internet chat, so please leave in the attribution lines. > > He won't, any more than you'll fix your sig. There is nothing about my sig that needs fixing. You are confusing a Usenet sig with something else. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | Samuel Smythe <s.smythe@yahoo.com> |
|---|---|
| Date | 2011-08-20 18:37 -0400 |
| Message-ID | <hhstzuxqj8o2.6vueph1oxndl.dlg@40tude.net> |
| In reply to | #2919 |
On Sat, 20 Aug 2011 23:31:03, Thomas 'PointedEars' Lahn wrote: > Samuel Smythe wrote: > >> On Sat, 20 Aug 2011 19:48:58, Thomas 'PointedEars' Lahn wrote: >>> This is not an Internet chat, so please leave in the attribution lines. >> >> He won't, any more than you'll fix your sig. > > There is nothing about my sig that needs fixing. You are confusing > a Usenet sig with something else. See? I told ya! > PointedEars <--- signature -- Sig Heil!
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-08-21 00:41 +0200 |
| Message-ID | <2514257.qnpttEiurS@PointedEars.de> |
| In reply to | #2920 |
Samuel Smythe wrote: > On Sat, 20 Aug 2011 23:31:03, Thomas 'PointedEars' Lahn wrote: >> Samuel Smythe wrote: >>> On Sat, 20 Aug 2011 19:48:58, Thomas 'PointedEars' Lahn wrote: >>>> This is not an Internet chat, so please leave in the attribution lines. >>> He won't, any more than you'll fix your sig. >> There is nothing about my sig that needs fixing. You are confusing >> a Usenet sig with something else. > > See? I told ya! > >> PointedEars <--- signature And the *Usenet* signature is what follows the line with "-- ". (Told you.) PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
[toc] | [prev] | [next] | [standalone]
| From | Samuel Smythe <s.smythe@yahoo.com> |
|---|---|
| Date | 2011-08-20 19:04 -0400 |
| Message-ID | <1lqzprnlx3r4a.yb2loiw9h1t9$.dlg@40tude.net> |
| In reply to | #2921 |
On Sun, 21 Aug 2011 00:41:48, Thomas 'PointedEars' Lahn wrote: > And the *Usenet* signature is what follows the line with "-- ". > (Told you.) <sighs> I didn't say "*Usenet* signature; I said "sig". -- > PointedEars Sig Heil!
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web