You are here: Re: [PHP] Wikimedia - php4 « PHP « IT news, forums, messages
Re: [PHP] Wikimedia - php4

Posted by Rasmus Lerdorf on 09/21/05 07:58

Vizion wrote:
> function &setupTemplate( $classname, $repository=false, $cache_dir=false ) {
> return new $classname();
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }

Is that really all they have in that function? It seems rather useless
to me. Why call a function just to instantiate a class like that?

Regardless, here it is trying to create a reference to a temp var.
Basically PHP will ignore the reference here, and it should work, but
you are getting a notice because the reference is being discarded.
Either drop the reference from the function definition or do:

$class =& new $classname();
return $class;

And for PHP5 you can just drop all references related to objects and it
will do the right thing.

-Rasmus

 

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

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