|
Posted by Gunnar G on 02/07/07 12:19
Now I've tried working with classes, but I still get an error of
redeclaration.
Fatal error: Cannot redeclare bar() (previously declared
in /var/www/localhost/htdocs/bar.php:3)
in /var/www/localhost/htdocs/bar.php on line 3
Is there any way to fix this without changing bar.php or main.php ?
Hereis the code
---------------- main.php --------------
<?php
include "foo.php";
include "foo2.php";
foo ::fooX();
foo2::foo2X();
?>
------------ foo2.php --------------
<?php
class foo2
{
static function foo2X()
{ include 'bar.php';
return bar()+1;}
}
?>
-------------- foo.php ----------
<?php
class foo
{
static function fooX()
{include 'bar.php';
return bar()+1;}
}
?>
------------- bar.php -----------
<?php
function bar()
{return 4;}
?>
Navigation:
[Reply to this message]
|