usage of $this

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
junjustkim
Forum Commoner
Posts: 44
Joined: Thu May 22, 2008 8:48 pm

usage of $this

Post by junjustkim »

Hi to all

I know this is very simple question, I am new in this environment. I found out this code in the sample script and I don't know the meaning by using of "$this" and "@mysql_close" I know mysql_close but what's the use of (@) sign. Furtheremore could you give an idea how can I search this characteristics and usage.

thanks in advance
User avatar
Frozenlight777
Forum Commoner
Posts: 75
Joined: Wed May 28, 2008 12:59 pm

Re: usage of $this

Post by Frozenlight777 »

The @ symbol stops errors from being displayed when calling a function. As far as ' $this-> ' is for accessing variables within a class. Hope that helps, maybe someone can show a better response.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: usage of $this

Post by Eran »

Just a small addition - $this represents the object you are in, from within an object scope. It can be used to access members, invoke methods or manipulate the object in different ways.
junjustkim
Forum Commoner
Posts: 44
Joined: Thu May 22, 2008 8:48 pm

Re: usage of $this

Post by junjustkim »

thank you so much for your immediate replied

Cheers
:P
Post Reply