Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2834 > unrolled thread

A Few Noob Questions

Started by"eBob.com" <eBob.com@totallybogus.com>
First post2011-08-16 11:02 -0400
Last post2011-08-18 10:12 -0400
Articles 7 on this page of 27 — 9 participants

Back to article view | Back to comp.lang.php


Contents

  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 2 of 2 — ← Prev page 1 [2]


#2923

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-20 21:44 -0400
Message-ID<j2pnup$ftp$1@dont-email.me>
In reply to#2922
On 8/20/2011 7:04 PM, Samuel Smythe wrote:
> 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".
>

Don't bother - many people in multiple newsgroups have tried to show the 
troll the errors of his ways (not just with sigs, either).  But of 
course, it's the rest of the world who doesn't conform to his wishes.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2924

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-08-21 09:16 +0200
Message-ID<2984353.SPkdTlGXAF@PointedEars.de>
In reply to#2922
Samuel Smythe wrote:

> 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".

"Sig" is a common abbreviation for Usenet signature.  And a Usenet signature 
is by convention limited in length.  And now the conclusion – or further 
trolling – on your part.


F'up2 poster

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]


#2918

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-20 15:52 -0400
Message-ID<j2p39p$le1$1@dont-email.me>
In reply to#2873
On 8/18/2011 12:40 PM, 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? :)
>

Not in the same sense as an executable program.  Scripting languages 
like PHP and Java are compiled to an intermediate language which is 
(pretty much) hardware independent.  This intermediate code is then 
processed by another program to generate the machine code the processor 
understands.  In PHP and some other scripting languages, this is done 
every time the script is executed.  In Java and other scripting 
languages, the conversion to intermediate code is performed once and 
stored in a file.  The run-time processor just processes the 
intermediate code.

What is classically known as "compilation" is different in that it means 
the machine code itself is stored and no run-time program is required to 
execute it.  Languages such as C/C++, PASCAL and FORTRAN are compiled, 
for instance.

>> 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?

Yes, that's one term used.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2856

FromDenis McMahon <denis.m.f.mcmahon@gmail.com>
Date2011-08-16 21:30 +0000
Message-ID<4e4ae161$0$27229$a8266bb1@newsreader.readnews.com>
In reply to#2834
On Tue, 16 Aug 2011 11:02:40 -0400, eBob.com wrote:

> How can the "units" of PHP between tags communicate?  Can my PHP code
> create $GLOBALS variables?  How about $_SESSION variables?

PHP processes a file. Within a file, you may have bunches of php code 
between "<?php" and "?>" tags, and may also have text output. The php 
code may include other files in various ways.

All the code in the file, including in any included files, that is not 
part of a separate function definition operates in the same variable 
context.

So, assuming between these cutlines is a single file:

------------8<------------
<?php
$a = 6;
?>
output this text
<?php
echo $a . "\n"; // uses the previously defined value for $a
?>
------------8<------------

If I save that as "basic.php" and then execute it in the cli:

~$ php basic.php
output this text
6

~$

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#2862

From"eBob.com" <eBob.com@totallybogus.com>
Date2011-08-16 20:31 -0400
Message-ID<mZD2q.116677$T_6.85093@en-nntp-04.dc1.easynews.com>
In reply to#2856
Thank you very much Denis.  But now I have to ask ... How global are the 
$GLOBALS?  From you answer I assume that $GLOBALS have a scope which exceeds 
one file.  But how far beyond one file?

Are there any kind of read/write variables which are shared between users?

Thanks,  Bob


"Denis McMahon" <denis.m.f.mcmahon@gmail.com> wrote in message 
news:4e4ae161$0$27229$a8266bb1@newsreader.readnews.com...
> On Tue, 16 Aug 2011 11:02:40 -0400, eBob.com wrote:
>
>> How can the "units" of PHP between tags communicate?  Can my PHP code
>> create $GLOBALS variables?  How about $_SESSION variables?
>
> PHP processes a file. Within a file, you may have bunches of php code
> between "<?php" and "?>" tags, and may also have text output. The php
> code may include other files in various ways.
>
> All the code in the file, including in any included files, that is not
> part of a separate function definition operates in the same variable
> context.
>
> So, assuming between these cutlines is a single file:
>
> ------------8<------------
> <?php
> $a = 6;
> ?>
> output this text
> <?php
> echo $a . "\n"; // uses the previously defined value for $a
> ?>
> ------------8<------------
>
> If I save that as "basic.php" and then execute it in the cli:
>
> ~$ php basic.php
> output this text
> 6
>
> ~$
>
> Rgds
>
> Denis McMahon 

[toc] | [prev] | [next] | [standalone]


#2863

FromA.Reader <anonymously@example.com>
Date2011-08-17 05:50 -0400
Message-ID<ct1n47lde3340lu646qe5hhrlc496mpjfu@4ax.com>
In reply to#2862
On Tue, 16 Aug 2011 20:31:30 -0400,
"eBob.com" <eBob.com@totallybogus.com> wrote:

>Thank you very much Denis.  But now I have to ask ... How global are the 
>$GLOBALS?  From you answer I assume that $GLOBALS have a scope which exceeds 
>one file.  But how far beyond one file?
>
>Are there any kind of read/write variables which are shared between users?

I'd suggest avoiding $GLOBALS because it's a bit old and kludgey.

The $_SESSION array is available to all your routines and
persistent within your context --it's automagically saved and
restored between your pages and sessions.   So you could have a
number of different programs with different purposes all sharing
the same $_SESSION array. 

But your $_SESSION array is not available to anyone else unless
you contrive to make it available, for example by mailing the
other person your persistent session cookie, in effect making
that person a virtual you.

As far as sharing vars between users, I think you'd have to work
at it since one of PHP's goals is that your storage NOT be
available to others.   

I've not so far had any need for it, so there might well be a
half-dozen solutions floating around out there, but if I did need
to have shared memory, I'd look into sockets, or shmem if the
users were all served from the same machine.  The memory-caching
daemon memcached might be useful too.

[toc] | [prev] | [next] | [standalone]


#2871

From"eBob.com" <eBob.com@totallybogus.com>
Date2011-08-18 10:12 -0400
Message-ID<Q493q.150290$7C3.35500@en-nntp-06.dc1.easynews.com>
In reply to#2863
Thank you very much A.

Bob

"A.Reader" <anonymously@example.com> wrote in message 
news:ct1n47lde3340lu646qe5hhrlc496mpjfu@4ax.com...
> On Tue, 16 Aug 2011 20:31:30 -0400,
> "eBob.com" <eBob.com@totallybogus.com> wrote:
>
>>Thank you very much Denis.  But now I have to ask ... How global are the
>>$GLOBALS?  From you answer I assume that $GLOBALS have a scope which 
>>exceeds
>>one file.  But how far beyond one file?
>>
>>Are there any kind of read/write variables which are shared between users?
>
> I'd suggest avoiding $GLOBALS because it's a bit old and kludgey.
>
> The $_SESSION array is available to all your routines and
> persistent within your context --it's automagically saved and
> restored between your pages and sessions.   So you could have a
> number of different programs with different purposes all sharing
> the same $_SESSION array.
>
> But your $_SESSION array is not available to anyone else unless
> you contrive to make it available, for example by mailing the
> other person your persistent session cookie, in effect making
> that person a virtual you.
>
> As far as sharing vars between users, I think you'd have to work
> at it since one of PHP's goals is that your storage NOT be
> available to others.
>
> I've not so far had any need for it, so there might well be a
> half-dozen solutions floating around out there, but if I did need
> to have shared memory, I'd look into sockets, or shmem if the
> users were all served from the same machine.  The memory-caching
> daemon memcached might be useful too. 

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.php


csiph-web