PHP | DirectoryIterator isLink() Function
Last Updated :
07 Mar, 2024
The DirectoryIterator::isLink() function is an inbuilt function in PHP which is used to check the current DirectoryIterator item is a symbolic link or not.
Syntax:
bool DirectoryIterator::isLink( void )
Parameters: This function does not accept any parameters.
Return Value: This function returns TRUE if the item is a symbolic link, otherwise returns FALSE.
Below programs illustrate the DirectoryIterator::isLink() function in PHP:
Program 1:
<?php
$directory = new DirectoryIterator(dirname( __FILE__ ));
foreach ( $directory as $dir ) {
$link = $dir ->isLink();
var_dump( $link );
}
?>
|
Output:
bool(false)
bool(false)
bool(false)
Program 2:
<?php
$directory = new DirectoryIterator(dirname( __FILE__ ));
while ( $directory ->valid()) {
$link = $directory ->isLink();
var_dump( $link );
$directory ->next();
}
?>
|
Output:
bool(false)
bool(false)
bool(false)
Note: The output of this function depends on the content of server folder.
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...