On Tue, 25 Sep 2001 17:01, Bård Tommy Nilsen wrote:
> Hello !
>
> I am trying to keep my string after including av file.
>
> file1.php:
> (accessed with file1.php?id=1)
>
> <?php
> include 'index.php';
>
> function func() {
> echo "buddy";
> }
> ?>
>
> index.php:
> <?php
> echo "Hello";
> if (function_exists('func')) {
> call_user_func ('func');
> }
>
> The output should then be "Hello buddy";
>
> Can anyone help me with this one ??
>
> Regards
> Bård Tommy Nilsen
In most languages, you must declare a function _before_ calling it. In
your case, your program looks like this after the include:
<?php
// include 'index.php';
echo "Hello";
if (function_exists('func')) {
call_user_func ('func');
}
function func() {
echo "buddy";
}
So you have no function at the time you test for it :-)
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Useless Invention: Rollerblade skates for peglegs.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]