Re: comparing string values, etc

From: Date: Sun, 03 Mar 2002 11:12:01 +0000
Subject: Re: comparing string values, etc
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86969@lists.php.net to get a copy of this message
Hi Tim, > I'm a major newbie. I was in the navy so never made it to major!? I'm only going to comment on your syntax and ignore the wide/Unix-related issues: > $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); ... $noting and $nothing - typo? if ($contents == $checkval ) { - you don't want to read $checkval from the input file - this comparison will be absolutely precise with no allowance for case sensitivity, extra spaces, double instead of single quotes etc. Hope that's ok with you!? fwrite ($filename, $nothing); - I've not tried this, but after reading to the end of the existing contents will the 'new data' be added to the end of the existing contents, or overwrite them? Please check. Hope this gets you started, =dn

« previous php.general (#86969) next »