array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'splfileinfo.isfile.php', 1 => 'SplFileInfo::isFile', 2 => 'Tells if the object references a regular file', ), 'up' => array ( 0 => 'class.splfileinfo.php', 1 => 'SplFileInfo', ), 'prev' => array ( 0 => 'splfileinfo.isexecutable.php', 1 => 'SplFileInfo::isExecutable', ), 'next' => array ( 0 => 'splfileinfo.islink.php', 1 => 'SplFileInfo::isLink', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/spl/splfileinfo/isfile.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SplFileInfo::isFile

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

SplFileInfo::isFileTells if the object references a regular file

Beschreibung

public SplFileInfo::isFile(): bool

Checks if the file referenced by this SplFileInfo object exists and is a regular file.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Returns true if the file exists and is a regular file (not a link), false otherwise.

Beispiele

Beispiel #1 SplFileInfo::isFile() example

<?php
$info
= new SplFileInfo(__FILE__);
var_dump($info->isFile());

$info = new SplFileInfo(dirname(__FILE__));
var_dump($info->isFile());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

bool(true)
bool(false)