comparing strings values, etc.

From: Date: Sun, 03 Mar 2002 10:46:45 +0000
Subject: comparing strings values, etc.
Groups: php.dev 
Request: Send a blank email to php-dev+get-80633@lists.php.net to get a copy of this message
Hi - I'm a major newbie. - I have a file that pulls an include into a <textarea> for a user to edit - before pulling the include, I'd like to open it and check it's value - if the include's value is exactly equal to the string: <div style='color: #eee; font: bold 80px Georgia, serif'>Hello World</div> then I want to overwrite that string with nothing; close the include; and then load it (now null) into the textarea - else, if the include's value is not equal to the above string, just load it into the <textarea> However embarrassing, I'll give what I have which hasn't been working $noting = ""; $checkval = "<div style='color: #F00; font: bold 80px Georgia, serif'>Hello World</div>"; $filename = "thefile.inc"; $fd = fopen ($filename, "w"); $contents = fread ($fd, filesize ($filename)); if ($contents == fread ($checkval)) { fwrite ($filename, $nothing); fclose ($fd); include($filename); } else { fclose ($fd); include($filename); } clearstatcache(); //for the next time around? Also - does thefile.inc have to be CHMOD 666? BTW - the server is running PHP4/Apache. thx //t

« previous php.dev (#80633) next »