Home > Archive > PHP Language > March 2004 > include problem - understanding?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
include problem - understanding?
|
|
| Ian Hobson 2004-03-29, 2:33 pm |
| Hi All,
I have a .php file with in an include that brings in two function
definitions.
The basic outline is this
<?php
session_start();
// removed... validate session and redirect to login page if not
logged in
// place 1
// unpack command, and do it.
$ACT = $_REQUEST['act'];
while ($ACT != "Done")
{ if ($ACT == "Save") $ACT = doSave();
if ($ACT == "Dele") $ACT = doDelete();
if ($ACT == "List") $ACT = doList();
if ($ACT == "Show") $ACT = doShow();
if ($ACT == "Edit") $ACT = doEdit();
}
// place 2 - there are only called functions from here on down.
include "admmenu.php";
function doSave()
{ .... etc
If I have the include in place 1 the calls to the functions work fine.
If I place it in place 2, it fails with Call to undefined function
error.
Is this how PHP is supposed to work, and (more importantly) what are the
placement rules so I know how to avoid this problem in future.
Regards
Ian
--
Ian - posting to a Newsgroup. Please remove everything to reply.
| |
|
| Ian Hobson wrote:
> If I have the include in place 1 the calls to the functions work fine.
> If I place it in place 2, it fails with Call to undefined function
> error.
>
> Is this how PHP is supposed to work, and (more importantly) what are
> the placement rules so I know how to avoid this problem in future.
function before function call
kreso
http://www.plus.hr/cgi-bin/aff/g.o/gdprom
www.gdprom.com
| |
| Ian Hobson 2004-03-30, 2:31 pm |
| In message <c4barr$2esf76$1@ID-208070.news.uni-berlin.de>, Kreso
<kreso@purger.com> writes
>Ian Hobson wrote:
>
>function before function call
>
Definition before call makes perfect sense - but is true in the failing
case as well as the working one.
The calls are in the lower functions - after the definition in both
case.
Regards
Ian
--
Ian - posting to a Newsgroup. Please remove everything to reply.
|
|
|
|
|