如何检查文件something(一个数字).php是否存在?

如何检查文件something(一个数字).php是否存在?,php,file,file-exists,Php,File,File Exists,假设我将所有这些文件都放在一个文件夹中: something(34324).php something(34).php something(3433454546).php something(65565).php something(9887).php something(4585).php // ect ect 现在我需要检查是否存在something.php文件(忽略数字) 因此,如果文件夹中存在something(a_number).php,请返回true 关于如何执行类似操作,您有什么

假设我将所有这些文件都放在一个文件夹中:

something(34324).php
something(34).php
something(3433454546).php
something(65565).php
something(9887).php
something(4585).php // ect ect
现在我需要检查是否存在
something.php
文件(忽略数字)

因此,如果文件夹中存在
something(a_number).php
,请返回true

关于如何执行类似操作,您有什么想法吗?

您可以使用,它返回与通配符模式匹配的目录内容数组

$somethings = glob('something*.php');
if (!empty($somethings)) {
    // something exists
}