Getting the Variables of a function listed in the construct?
<p>I'm not an amazing developer so please bear with me, but I've begun using classes and functions, and I really like how I can write a library. A single page where all my PHP can go. I was thinking though, my life would be a millon times easier if I could check the variables of a function in the construct, and escape them all before running the function. That way, I wouldn't have to escape each variable for each function.</p>

<p>I'd need to be able to have the construct somehow check and see what the variables are in the function, and then escape them. </p>

<pre><code>so X = 'Variable for a function' 
   X = mysqli_real_escape_String($conn, X);
</code></pre>

<p>Could anyone please tell me if this is possible, and if not, what other options could you suggest? </p>

<p>P.S. I'm not advanced enough to use PDO yet, so please keep the advice to procedural programming.</p>

<p>Sorry, perhaps I'm not explaining this correctly. What I'm trying to do is eliminate the need to escape variables in my library that come when someone calls a function($vars). So the idea is to write some type of script within the __construct that will check the $vars and escape them before the function is ran. </p>

<pre><code>class users
{
function __construct()
{
   //the idea is that i can somehow escape the variables within the function
   //for the function that's being called
    function magical_funtion_that_calls_all_variables()
    {
        foreach($var)
        {
            $var = mysqli_real_escape_string($conn, $var);
        }
    }
}

function register($user, $pass1, $pass2)
{
</code></pre>
