note 21013 added to function.fopen

From: Date: Thu, 25 Apr 2002 11:22:41 +0000
Subject: note 21013 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-29829@lists.php.net to get a copy of this message
this example: $out=fopen("file","w") || die ("file won't open"); is _not_ true on my server (linux redhat) and windows98se - it's creating an empty file, but fwrite shows only error like that: $out is not right file handle. when i remove die clausule, it works fine! instead above example, use this: $out=fopen ("file.txt", "w"); if ($out) { fwrite ($out, "some text"); fclose ($out); } else { echo "error"; } btw: don't use 'die' within functions in ur classes - it kills php! greetz:) Sir_Fred -- http://www.php.net/manual/en/function.fopen.php http://master.php.net/manage/user-notes.php?action=edit+21013 http://master.php.net/manage/user-notes.php?action=delete+21013 http://master.php.net/manage/user-notes.php?action=reject+21013

« previous php.notes (#29829) next »