- var_dump: documentation ( source)
- array_filter: documentation ( source)
<?php
$data = ['foo', 'bar'];
var_dump($data);
$filtered = array_filter($data, function (&$value) {
$value = (bool) $value;
return true;
});
var_dump($filtered);