remove each() keyword as it is deprecated as of php-7.2, fixes #479

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2017-10-31 13:03:06 +01:00
parent 15b62aae04
commit 421c29c491
10 changed files with 23 additions and 26 deletions

View File

@@ -20,27 +20,22 @@
/**
* Returns Array, whose elements have been checked whether thay are empty or not
*
* @param array The array to trim
* @param array $source
* The array to trim
* @return array The trim'med array
* @author Florian Lippert <flo@syscp.org>
*/
function array_trim($source)
{
$returnval = array();
if(is_array($source))
{
while(list($var, $val) = each($source))
{
if($val != ' '
&& $val != '')$returnval[$var] = $val;
if (is_array($source)) {
foreach ($source as $var => $val) {
if ($val != ' ' && $val != '') {
$returnval[$var] = $val;
}
}
}
else
{
} else {
$returnval = $source;
}
return $returnval;
}