You are here: Re: include files with similar contents « PHP Programming Language « IT news, forums, messages
Re: include files with similar contents

Posted by Jerry Stuckle on 02/05/07 23:17

Gunnar G wrote:
>> A function cannot be redeclared, and this will result in an error. If they
>> do different things, you should name them different accordingly. You can
>> however declare functions in mulitple places with a conditional, allthough
>> it's not advisable (if the function changes you have to make changes all
>> over). This is done by:
>> if(!function_exists('foo')){
>> function foo(){
>> //etc...
>> }
>> }
>
> This makes me think.
>
> Imagine you enter the file mypage.php that contains a function foo, and you
> have to run the function foo that is in the file a.php.
> Then you can't include a.php, so then how do execute the code in a.php
> withouth leaving mypage.php? a.php should return one or two values back
> to mypage.php.
>
> I'd rather not rename the functions, so is there any solution to this?

Gunnar,

You don't. As Rik said - different functions should have different names.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация