- var_export: documentation ( source)
- str_ends_with: documentation ( source)
<?php
$array = ['one.php', 'two.txt'];
$found = false;
foreach ($array as $filename) {
if (str_ends_with($filename, '.txt')) {
$found = true;
break;
}
}
var_export($found);