PHP and current file's contents

software development

#1

Anybody know if PHP stores the contents of the current file in any sort of global variable? What I’m trying to do is optimize a function I’ve got which determines whether or not the current document’s doctype is defined as HTML Strict; if it is, then I use that to determine what attributes I can add to certain HTML tags.

I currently use a function I wrote:

[code]Function is_defined_strict( $file ){
$dtd = ‘<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”’;

if( file_exists($file) ){
$fd = fopen( $file, “r”);
$ln0 = rtrim(fgets($fd));
fclose($fd);
return ( ( $ln0 == $dtd ) || ( $ln0 == $dtd.’>’ ) );
} else {
return FALSE;
}
}
[/code]which then usually gets called with something like

is_defined_strict( $_SERVER["PATH_TRANSLATED"] ) I’d like to avoid the additional call to open the current document again if I can, but I don’t see anything in the filesystem functions or elsewhere that seems to store anything other then the current filename.

Any thoughts?