Reply to Re: include files with similar contents

Your name:

Reply:


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)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация