Reply to Re: Put my function as default function?

Your name:

Reply:


Posted by Jerry Stuckle on 10/03/06 13:34

howachen@gmail.com wrote:
> I have a function foo(), I want all my page can call this method
> without include / require
>
> I know I can set in php.ini by setting the auto_prepend...
>
> but this will cause overhead as every file need to prepend this file
> even no call to the function,
>
> are there any better method?
>
> instead of writting an extension?
>
> thanks.
>

Sure, just put a copy of the function in every file which will call it.
That way you don't have to include it and it's available. Of course,
you'll have dozens (or hundreds) of copies running around, but who cares?

Seriously - if you don't include the file, how is PHP supposed to know
what to execute? Any function you're going to call must either be
defined in that file (directly or via include/require), or defined in
PHP or a PHP extension.

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

[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

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