There are 2 places where $account_name occurs in my code, one where is the name of an argument of a function:
functions.php:
function getAccountID ($account_name) {
$account_id = mysql_query("SELECT account_id FROM accounts WHERE account_name = '$account_name'");
$account_id = (mysql_fetch_assoc($account_id));
}
and the other where it is a variable with a value
index.php:
$account_name = $fileop[0];
$account_id = getAccountID($account_name);
I am aware that the two instances of the variable have completely separate uses: the first is just a placeholder for the function to take an argument, and the second carries a value outside the function's scope. I am trying to simplify things as much as possible which is why I would like them to be the same. Does this work and if so is it acceptable practice?
argumentisn't a placeholder, it's the variable name that will be used for that argument within the scope of that function