👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
Syntax:bool SplFileInfo::isFile (void)Parameters:this function takes no parameters.Return Values:this function returns true if the file exists, otherwise - false.The following programs illustrate the SplFileInfo::isFile() function in PHP:Program 1:
// Program PHP for illustration
// Splfileinfo isFile function
$file
=
new
SplFileInfo (dirname (
" gfg.txt "
));
$gfg
=
$file
-> isFile();
// Print the result
var_dump (
$gfg
);
echo
"< / br >"
;
$file
=
new
SplFileInfo (
__ FILE__
);
$gfg
=
$file
-> isFile();
// Print the result
var_dump (
$gfg
);
?>
Output:bool (false) bool (true)
Program 2:
// PHP program to use an array for checking
// multiple files
$GFG
=
array
(
"/ home / rajvir / Desktop / GeeksforGeeks / dummy.php"
,
"/ home / rajvir / Desktop / gfg_code.cpp"
,
"/ var / www / html /"
,
" frame.php "
);
foreach
(
$GFG
as
& amp;
$file_name
) {
// Create a new SplFile object
$file
=
new
SplFileInfo (
$file_name
);
$gfg
=
$file
-> isFile();
// Print the result
var_dump (
$gfg
);
echo
"< / br > "
;
}
?>
Output:bool (false) bool (false) bool (true) bool (false)
Link: http://php.net/manual/en/splfileinfo.isfile.php
👻 Read also: what is the best laptop for engineering students?
We hope this article has helped you to resolve the problem. Apart from PHP SplFileInfo isFile () function, check other array Python module-related topics.
Want to excel in Python? See our review of the best Python online courses 2023. If you are interested in Data Science, check also how to learn programming in R.
By the way, this material is also available in other languages:
- Italiano PHP SplFileInfo isFile () function
- Deutsch PHP SplFileInfo isFile () function
- Français PHP SplFileInfo isFile () function
- Español PHP SplFileInfo isFile () function
- Türk PHP SplFileInfo isFile () function
- Русский PHP SplFileInfo isFile () function
- Português PHP SplFileInfo isFile () function
- Polski PHP SplFileInfo isFile () function
- Nederlandse PHP SplFileInfo isFile () function
- 中文 PHP SplFileInfo isFile () function
- 한국어 PHP SplFileInfo isFile () function
- 日本語 PHP SplFileInfo isFile () function
- हिन्दी PHP SplFileInfo isFile () function
Anna Galleotti
California | 2023-01-29
I was preparing for my coding interview, thanks for clarifying this - PHP SplFileInfo isFile () function in Python is not the simplest one. I just hope that will not emerge anymore
Chen Innsbruck
Tallinn | 2023-01-29
Maybe there are another answers? What PHP SplFileInfo isFile () function exactly means?. Will get back tomorrow with feedback
Julia Schteiner
Massachussetts | 2023-01-29
Thanks for explaining! I was stuck with PHP SplFileInfo isFile () function for some hours, finally got it done 🤗. Checked yesterday, it works!