tags:

views:

49

answers:

1

Hi! I'm trying to improve my understanding on OOP^^

If I call this file...

set_organization.php file:

$organization = new Organization( );
$organization->name = 'Name here';
$organization->founder = 'Founder here';

then I access it again, are the name, and founder already set? Or should I put unset to ensure it's empty, like fresh start again? I'm kind of confused whether I need to unset it something like this:

$organization = new Organization( );
$organization->name = 'Name here';
$organization->founder = 'Founder here';
unset($organization);

to avoid query related bugs...please help.

Thanks!

+2  A: 

Each time you call new Organization( ); a new instance is created that has nohing to do with any previous ones (except static class members).

If this is done in sepereate requests even more so, but this is because each request runs it's own script.

Mchl
So it's like fresh start...no need for unset. Thanks! No more confusion^^
Woppi