whelpton Posted March 15, 2009 Share Posted March 15, 2009 Hello, Is there anyway of checking if a text file is blank? I cant seem to find a function anywhere in the manual for this. Thanks Link to comment https://forums.phpfreaks.com/topic/149565-solved-checking-if-a-file-is-blank/ Share on other sites More sharing options...
trq Posted March 15, 2009 Share Posted March 15, 2009 filesize will return 0 if the file is empty. Link to comment https://forums.phpfreaks.com/topic/149565-solved-checking-if-a-file-is-blank/#findComment-785418 Share on other sites More sharing options...
Rodis Posted March 15, 2009 Share Posted March 15, 2009 Use the function empty() For example $file = file_get_contents("file.txt"); if (empty($file)){ echo "This file is empty"; } Link to comment https://forums.phpfreaks.com/topic/149565-solved-checking-if-a-file-is-blank/#findComment-785420 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.