You are here: Re: classes: strange behavior « PHP Programming Language « IT news, forums, messages
Re: classes: strange behavior

Posted by Chung Leong on 05/07/06 19:41

Paul Czubilinski wrote:
> Hi Chung,
> include('B.php');
> $a = new A();
> class A extends B {....}

This doesn't work because include() is a runtime operation. B.php
doesn't just get inserted into A.php. The behavior is somewhat like a
function call.

While compiling A.php, PHP doesn't know what B is. Therefore the
definition ("binding" to be more precise) of A has to be done at
runtime. And as new A() occurs before class A {} in the code, the
operation fails.

 

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

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