1--TEST-- 2Test is_file() function: basic functionality 3--FILE-- 4<?php 5/* Prototype: bool is_file ( string $filename ); 6 Description: Tells whether the filename is a regular file 7 Returns TRUE if the filename exists and is a regular file 8*/ 9 10echo "*** Testing is_file(): basic functionality ***\n"; 11 12/* Checking with current file */ 13var_dump( is_file(__FILE__) ); 14 15/* Checking with (current) dir */ 16var_dump( is_file(dirname(__FILE__)) ); 17 18$file_path = dirname(__FILE__); 19$file_name = $file_path."/is_file_basic.tmp"; 20/* With non-existing file */ 21var_dump( is_file($file_name) ); 22/* With existing file */ 23fclose( fopen($file_name, "w") ); 24var_dump( is_file($file_name) ); 25 26echo "*** Testing is_file() for its return value type ***\n"; 27var_dump( is_bool( is_file(__FILE__) ) ); 28var_dump( is_bool( is_file("/no/such/file") ) ); 29 30echo "\n*** Done ***"; 31?> 32--CLEAN-- 33<?php 34$file_path = dirname(__FILE__); 35$file_name = $file_path."/is_file_basic.tmp"; 36unlink($file_name); 37?> 38--EXPECTF-- 39*** Testing is_file(): basic functionality *** 40bool(true) 41bool(false) 42bool(false) 43bool(true) 44*** Testing is_file() for its return value type *** 45bool(true) 46bool(true) 47 48*** Done *** 49