Cómo verificar si FWrite falló PHP

fOpen("TestFile.txt", "w+");

if(fwrite("Test data") === false){
	
	echo("Data writing failed.");
	
}else{
	
	echo("Data writing successfull.");
}

fclose();
Cautious Crane