You are here: Re: unset($this) or maybe unset(&$this) « PHP Programming Language « IT news, forums, messages
Re: unset($this) or maybe unset(&$this)

Posted by Tony Marston on 02/23/06 12:02

"Oli Filth" <catch@olifilth.co.uk> wrote in message
news:0F7Lf.59404$mf2.36568@newsfe6-win.ntli.net...
> Tony Marston said the following on 21/02/2006 09:46:
>> Don't be silly. The execution path is sequential, so after a command
>> which does not involve a jump is executed the next instruction to be
>> executed will be the very next instruction in the same object method. If
>> you have just erased the object that contains the next instruction what
>> do you think will happen? How is the PHP processor supposed to know where
>> to go?
>>
>
> I dunno about PHP, but the equivalent is perfectly possible in C++, i.e.
> you can call delete on this (assuming it's a heap-based object).
>
> The object and its method code are not one and the same thing. Deleting an
> object doesn't mean that the code disappears...

An object is comprised of methods (code) and properties (variables). If you
delete/unset an object then both disappear as all their reference points no
longer exist. The code may still exist in the class definition, but the
object, which contains a copy of that code in memory, does not, so how can
it continue executing any of that code?

Deleting an object while you are still inside it is like blowing up a house
when you are still inside - not a good idea!

 

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

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