static function validate ($code, &$output = 0)
  {
    $b = 0;
    foreach (token_get_all ($code) as $token)
      if ('{' == $token)
        ++$b;
      elseif ('}' == $token)
        --$b;
    if ($b)
      return false; // Unbalanced braces would break the eval below
    ob_start (); // Catch potential parse error messages
    $code = eval ('if(0){' . $code . '}'); // Put $code in a dead code sandbox to prevent its execution
    if (func_num_args () > 1)
      $output = ob_get_clean ();
    else
      ob_end_clean ();
    return false !== $code;
  }