You are here: Re: storing php5 classes and function « PHP Programming Language « IT news, forums, messages
Re: storing php5 classes and function

Posted by Dikkie Dik on 12/23/07 10:23

> function __autoload($class_name) {
> require_once $class_name . '.php';
> }

One nice thing to notice: an included file can return a value, which may
be an instance. So you could write a class in a file that looks like this:

class WhatEver
{
....
}

return new WhatEver();

And then call that dynamically:

$obj = require($pathToWhatEver);

I use this trick for my unit testing system.

 

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

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