Search code examples
phpglob

How can I remove the file path when using Glob()?


I just want to display the name of my images, without the path (../uploadedImages/)

<?php $images = glob("../uploadedImages/[kK]*.{jpg,png,gif,bmp}",GLOB_BRACE);   
foreach($images as $image) {echo "$image<br>"} ?>

Solution

  • Use basename

    echo basename($image) . "<br>";