/**
* Function converts multidimentional array to a plain one
*
* @param $arr multidimensional array
*
* @return array
*/
function array_flatten($arr) {
$return = [];
foreach ($arr as $key => $value) {
if (is_array($value)) {
$return = array_merge($return, array_flatten($value));
} else {
$return[] = $value;
}
}
return $return;
}