contao/core — Issue #3773: Some code optimization. Use strpos instead of preg_match where it can do a job
Author: DyaGa
Created: 2012-01-06 19:06:48+00:00
State: open

For example, In `Comniner.php` see [add method](https://github.com/contao/core/blob/master/system/libraries/Combiner.php#L74). Here you are using this code:

```php
// Determine the file type
if (preg_match('/\.css$/', $strFile))
{
$strType = self::CSS;
}
elseif (preg_match('/\.js$/', $strFile))
{
$strType = self::JS;
}
```

but next code is much faster and better:

```php
// Determine the file type
if (strpos($strFile, self::CSS) !== false)
{
$strType = self::CSS;
}
elseif (strpos($strFile, self::JS) !== false)
{
$strType = self::JS;
}
```