|
Posted by Kimmo Laine on 02/06/07 10:04
"Gunnar G" <debian@comhem.se> wrote in message
news:qgYxh.31304$E02.12878@newsb.telia.net...
> Kimmo Laine wrote:
>
>> "Gunnar G" <debian@comhem.se> wrote in message
>> news:LmXxh.31301$E02.12903@newsb.telia.net...
>>> ... but moving the include line to this
>>>
>>> class a
>>> {
>>> include("page.php");
>>> function foo($x){return $x+1;}
>>> }
>>>
>>> class b
>>> {
>>> function foo($x){return $x+1;}
>>> }
>>>
>>> and it no longer works.
>>
>>
>> I'm guessing page.php defines another function named foo. In this case,
>> just take the extra foo from class a and throw it out the window. If you
>> include it from page.php, you don't need top redefine it... doi!
> Well, in this case page.php had only 6 characters in it
>
> <?php ?>
>
> so there should'nt be any problem.Very strange.
Okay, wasn't thinking straight. You can't call a function inside a class
definition. If you were inside a class method, then again it would be okay.
So you want:
class a {
function foo($x){
include("page.php");
return $x+1;
}
}
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|