- var_dump: documentation ( source)
- array_reduce: documentation ( source)
- in_array: documentation ( source)
<?php
declare(strict_types=1);
$values = ['true', false];
$needle = true;
$inArray = array_reduce($values, function ($inArray, $value) use ($needle) {
return $inArray || $value === $needle;
});
var_dump(in_array(true, $values));
var_dump($inArray);