isset variables created using extract function
<pre><code>$array = explode('/', $_SERVER['REQUEST_URI']);

$count = count($array);

extract($array, EXTR_PREFIX_ALL, 'var');
</code></pre>

<p>can the variables (created using extract function) be isseted automatically? to avoid "Notice: Undefined variable:" errors when error_reporting(E_ALL); is enabled.</p>

<p>thank you</p>

<p>I tried doing something of this sort, still needed to isset() whenever, the variables are used next in the code (when error_reporting(E_ALL); is enabled).</p>

<pre><code>if(isset($var_0))
{    
$var_0 = filter_var($var_0, FILTER_SANITIZE_STRING);  
}
if(isset($var_1))
{
$var_1 = filter_var($var_1, FILTER_SANITIZE_STRING);
}
if(isset($var_2))
{
$var_2 = filter_var($var_2, FILTER_SANITIZE_STRING);
}
if(isset($var_3))
{
$var_3 = filter_var($var_3, FILTER_SANITIZE_STRING);
}
</code></pre>

<p>==========================</p>

<p>Alternatively, tried the one line if condition,</p>

<pre><code>$var_0 = isset($var_0) ? filter_var($var_0, FILTER_SANITIZE_STRING) : '';     
$var_1 = isset($var_1) ? filter_var($var_1, FILTER_SANITIZE_STRING) : '';
$var_2 = isset($var_2) ? filter_var($var_2, FILTER_SANITIZE_STRING) : '';
$var_3 = isset($var_3) ? filter_var($var_3, FILTER_SANITIZE_STRING) : '';
</code></pre>

<p>while the error got subsided, but, a new problem arises i.e., variables (which are not created by extract function are getting isseted because of this one line if condition approach).</p>

<p>I am posting two of the routing rules (of two urls) in the website.</p>

<pre><code>$pagename = "not-found.php";

//Different Routing Engine Rules follows

if ((isset($var_1)) &amp;&amp; (($var_1 == "") || ($var_1 == "index.php"))) {


     if((isset($var_2)) || (isset($var_3)) || (isset($var_4)) || (isset($var_5)) || (isset($var_6)) || (isset($var_7)))
    {
      $pagename = "not-found.php";

    }
    else
    {

      $pagename = "default-home.php";

    }
}

if (($var_1 == "login")) 
{
//echo "Login Page URL\n";      

    if((isset($var_2)) || (isset($var_3)) || (isset($var_4)) || (isset($var_5)) || (isset($var_6)) || (isset($var_7)))
    {
      $pagename = "not-found.php";
    }
    else
    {
      $pagename = "login.php";  
    }
}

include "code/" . $pagename;
</code></pre>

<p>any help will be appreciated, thank you</p>
