开发者

OOP related question

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜