Q:

Cannot reassign $this variable

I'm trying to figure out why I'm getting a cannot reassign $this error message for the public function isUsernameAvailable($this->input->post('username')) line. I've looked over my code and can't locate the cause of why I can't do this. What the function is used for is a post jquery function with json sent to php.
public function isUsernameAvailable($username)
{
    if ($this->usersmodel->isUsernameAvailable($username))
    {
        echo '{"username":"found"}';
    }
    else
    {
        echo '{"username":"notfound"}';
    }        
}

jQuery
$('#username').blur(function(){
    $.post('register/isUsernameAvailable', {"username":$(this).val()}, function(data){if(data.username == "found"){alert('username already in use');}}, 'json');
});

Any ideas?
UPDATE :
I"m trying to find out if this is really a PHP issue or jQuery issue.
After it does the POST request it sends this as a parameter:
username testusername
In the response I get this:

A PHP Error was encountered

Severity: Warning
Message:  Missing argument 1 for Register::isUsernameAvailable()
Filename: controllers/register.php
Line Number: 118

A PHP Error was encountered

Severity: Notice
Message:  Undefined variable: username
Filename: controllers/register.php
Line Number: 120
{"username":"notfound"}

A:

$this can not be overwritten, it is the reference to the object you are in. If you could overwrite it you would lose the object.
In your code you have the line
public function isUsernameAvailable($this->input->post('username'))

this would cause the functions isUsernameAvailable first parameter be name $this->input->post('username'). That would cause that $this in the scope of the function would be overwritten.

