Is it possible to access Twig variables in a plugin variable using PHP?
You can’t access the current Twig variables (the “context”, as Twig calls them), from a Template Variable class, but you can access them with a template hook.

From your plugin’s init() function:

craft()-&gt;templates-&gt;hook('errorCheck', function(&amp;$context)
{
    if (isset($context['errors']))
    {
        // do something with $context['errors'];
    }
});


From your template:

{% hook "errorCheck" %}


You can modify, delete, and create variables within that $context array if you want. And because it is passed by reference (that’s what the “&amp;” does in “&amp;$context”, you won’t need to actually return the array at the end of the function or anything; just make your changes to it.