Question: In the function [mb\_detect\_encoding](http://php.net/manual/en/function.mb-detect-encoding.php) there is a parameter for strict mode.

In the first, most upvoted comment:

```
<?php
$str = 'áéóú'; // ISO-8859-1
mb_detect_encoding($str, 'UTF-8'); // 'UTF-8'
mb_detect_encoding($str, 'UTF-8', true); // false

```

This is true, yes. But can anybody give me an explanation, why is it?

Answer: 
`áéóú` in ISO-8859-1 encodes as:

```
e1 e9 f3 fa

```

If you mis-interpret it as UTF-8 you only get four invalid byte sequences. The Multi-Byte extension is basically designed to ignore errors. For instance, `mb_convert_encoding()` will replace those sequences with [question marks](http://www.fileformat.info/info/unicode/char/003f/index.htm) or whatever you set with `mb_substitute_character()`.

My educated guess is that strict encoding determines what should be done with invalid byte sequences:

* `false` means to remove them
* `true` means to keep them

If you ignore these invalid sequences you're obviously discarding extremely valuable information and you only get sensible results in very limited circumstances, e.g.

```
$str = chr(81);
var_dump( mb_detect_encoding($str, ['ISO-8859-1', 'Windows-1252']) );
var_dump( mb_detect_encoding($str, ['Windows-1252', 'ISO-8859-1']) );

```

To sum up, `mb_detect_encoding()` is in general not as useful as you may thing and it's total crap with the default parameters.
Because `$str` is not actual `UTF-8`, but `ISO-8859-1`. Since when not strict comparison, `UTF-8` may be treated same as `ISO-8859-1`, but when using strict mode only actual `UTF-8` fits for `UTF-8` comparison ([explained here](https://stackoverflow.com/questions/7048745/what-is-the-difference-between-utf-8-and-iso-8859-1))