I want to get an alternate of an sql query WHERE field LIKE '%subStr'
in PHP for example
actually I want to conditionally of different file types so I want to check whether the extension is .ppt
or .pptx
or .pptm
.ppm
or any thing else.
I want to get an alternate of an sql query WHERE field LIKE '%subStr'
in PHP for example
actually I want to conditionally of different file types so I want to check whether the extension is .ppt
or .pptx
or .pptm
.ppm
or any thing else.
You could do it this way.
$file = 'my-file.ppt';
$parts = pathinfo($file);
$extensions = array("ppt", "pptx", "pptm", "ppm");
if (in_array($parts['extension'], $extensions)) {
echo "we have {$parts['extension']}";
}
else {
echo "no matches";
}