Current time: 08-20-2017, 07:26 PM Hello There, Guest! (LoginRegister)

Post Reply 
PHP and current file's contents
07-19-2002, 01:39 PM
Post: #1
PHP and current file's contents
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:
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));
return ( ( $ln0 == $dtd ) || ( $ln0 == $dtd.'>' ) );
} else {
return FALSE;
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?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump: