You are here: Re: Programming Tips and Tricks « PHP Programming Language « IT news, forums, messages
Re: Programming Tips and Tricks

Posted by Scott Auge on 10/08/64 11:22

In article <6ddde1pkd3ompg1j68u0k5avr6o8p6cp3c@4ax.com>,
Andy Hassall <andy@andyh.co.uk> wrote:

> On Tue, 26 Jul 2005 22:09:42 GMT, "Don Freeman" <freemand@sonic.net> wrote:
>
> >"include_once() should be used in cases where the same file might be
> >included and evaluated more than once during a particular execution of a
> >script, and you want to be sure that it is included exactly once to avoid
> >problems with function redefinitions, variable value reassignments, etc.":
> >----
> >So now I get to ask an extremely dumb question...
> >
> >Why would you include the same file multiple times in the same file anyway?
>
> Usually, when you want the output produced by that file printed multiple
> times.
>
> stuff.php:
> <?php print "The value is: $var<br>"; ?>
>
> index.php:
> <?php
> $var = 1;
> include('stuff.php');
>
> $var = 2;
> include('stuff.php');
>
> $var = 3;
> include('stuff.php');
> ?>
>
> This is a contrived example, but sometimes it's what you want.


Followed up by include files that include other files which might
include other files. If it is a set of function definitions or class
definitions, you will only want it included once.
--
Available for Hire! http://amduus.com/Resumes/

 

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

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