Hey there,

got a question about $this. I thought this was a fixed variable to point to
the currently used object but I've seen a script wherein it's used within an
object like this

class a {
  $var = 0;

  function b {
     do something...
      $this ->var++;
    }
}

the $this here will increment the $var of the object a... so far so good.

now further in the script you'll get an sql query
$this = mysql_fetch_array(indentifier);

now as far as I knew you shouldn't be possible to use $this for this purpose,
it has nothing to do with objects... why can it be used? it's only confusing
things. The script works tho...

As far as I've seen in other languages, the things the language contains
can't be used for something else (think they're called language constructs?!)
anyways it would be sortta like trying to define a function print while one
already exists natively in the language. You shouldn't be able to do that
right? Does anyone mind explain why $this can be used as a normal var? this
is very confusing. And what is php gonna do if you have a var $this and use
$this to point to the current object?

Kind regards and have a nice weekend

-------------------------------------------------------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to