note 10030 modified in function.fopen by hholzgra

From: Date: Fri, 12 Jul 2002 15:00:34 +0000
Subject: note 10030 modified in function.fopen by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-32984@lists.php.net to get a copy of this message
Be careful how you test for errors from fopen(). The familiar construction: $out=fopen("file","w") || die ("file won't open"); is a great way NOT to create a working filehandle. Test instead with an if as in the note above. The || has the effect of overwriting the filehandle and rendering it useless. -- editors note: use 'or' instead of '||' --was-- Be careful how you test for errors from fopen(). The familiar construction: $out=fopen("file","w") || die ("file won't open"); is a great way NOT to create a working filehandle. Test instead with an if as in the note above. The || has the effect of overwriting the filehandle and rendering it useless. http://www.php.net/manual/en/function.fopen.php

« previous php.notes (#32984) next »