RE: [PHP] Using functions before they're defined
| From: | Martin Towell | Date: | Thu, 07 Feb 2002 22:17:09 +0000 |
| Subject: | RE: [PHP] Using functions before they're defined | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83926@lists.php.net to get a copy of this message | ||
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 foobar<br>\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:remery@excel.com]
Sent: Friday, February 08, 2002 6:06 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Using functions before they're defined
What happened when you tried?
-----Original Message-----
From: Brad Harriger [mailto:bradharriger@clarionhospital.org]
Sent: Thursday, February 07, 2002 8:22 AM
To: php-general@lists.php.net
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