RE: [PHP] Using functions before they're defined

2002-02-08 Thread Ford, Mike [LSS]

 -Original Message-
 From: Martin Towell [mailto:[EMAIL PROTECTED]]
 Sent: 07 February 2002 22:17
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Using functions before they're defined
 
 I haven't looked at the php's source code, but maybe it's a 
 two pass parser
 (??)  first it gets all the functions then it executes the 
 code 

Executing the code is not parsing!!  Executing the code happens *after* it's been 
parsed.  So, yes, it's a two-stage process, but the stages are parsing and executing.

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




[PHP] Using functions before they're defined

2002-02-07 Thread Brad Harriger

How does PHP 4 locate function definitions if the function is called 
before it is defined?


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




RE: [PHP] Using functions before they're defined

2002-02-07 Thread Rick Emery

What happened when you tried?

-Original Message-
From: Brad Harriger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 8:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Using functions before they're defined


How does PHP 4 locate function definitions if the function is called 
before it is defined?


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

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




RE: [PHP] Using functions before they're defined

2002-02-07 Thread Martin Towell

I've found that you can specify a function anywhere in the page and call it
anywhere in the page so:

?
foobar();
function foobar() { echo in foobarbr\n; }
foobar();
?

would work and display the text twice, without errors/warnings

I haven't looked at the php's source code, but maybe it's a two pass parser
(??)  first it gets all the functions then it executes the code 

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 6:06 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Using functions before they're defined


What happened when you tried?

-Original Message-
From: Brad Harriger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 8:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Using functions before they're defined


How does PHP 4 locate function definitions if the function is called 
before it is defined?


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

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



Re: [PHP] Using functions before they're defined

2002-02-07 Thread Jason Wong

On Friday 08 February 2002 06:17, Martin Towell wrote:
 I've found that you can specify a function anywhere in the page and call it
 anywhere in the page so:

 ?
 foobar();
 function foobar() { echo in foobarbr\n; }
 foobar();
 ?

 would work and display the text twice, without errors/warnings

 I haven't looked at the php's source code, but maybe it's a two pass parser
 (??)  first it gets all the functions then it executes the code 

Yes, it's all explained in the manual :)

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Charlie was a chemist,
But Charlie is no more.
For what he thought was H2O,
Was H2SO4.
*/

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