DirectoryIterator
PHP Manual

DirectoryIterator::__toString

()

DirectoryIterator::__toStringGet file name as a string

Описание

public string DirectoryIterator::__toString ( void )

Get the file name of the current DirectoryIterator item.

Параметри

Тази функция няма параметри.

Връщани стойности

Returns the file name of the current DirectoryIterator item.

Примери

Example #1 A DirectoryIterator::__toString example

This example will list the contents of the directory containing the script.

<?php
$dir 
= new DirectoryIterator(dirname(__FILE__));
foreach (
$dir as $fileinfo) {
    echo 
$fileinfo;
}
?>

Примерът по-горе ще изведе нещо подобно на:

.
..
apple.jpg
banana.jpg
index.php
pear.jpg

Вж. също


DirectoryIterator
PHP Manual