Using name of php variable in function : <p>This may seem like a very dumb question, but I don't know if it's possible. I'm trying to write a function as follows:</p>

<pre><code>function checkDuplicates($input) {
    $result = pg_query('SELECT username FROM accounts WHERE LOWER(username)=\''.strtolower(pg_escape_string($input)).'\'') or exit(pg_last_error());
}
</code></pre>

<p>and I want to replace "username" with the name of the variable being passed in. For example, if I called <code>checkDuplicates($email)</code>, I want essentially the following function to be called:</p>

<pre><code>function checkDuplicates($email) {
    $result = pg_query('SELECT email FROM accounts WHERE LOWER(email)=\''.strtolower(pg_escape_string($email)).'\'') or exit(pg_last_error());
}
</code></pre>

<p>Is there any way to do this?</p>
