Added the new function "set_when_empty"

This commit is contained in:
Alejandro Gallardo Escobar 2015-06-02 18:01:41 +02:00
parent f2539395c3
commit 127f53e8c8
1 changed files with 11 additions and 0 deletions
pandora_console/include

View File

@ -2386,6 +2386,17 @@ function set_unless_defined (&$var, $default) {
}
}
function set_when_empty (&$var, $default) {
if (empty($var)) {
$var = $default;
return true;
}
else {
return false;
}
}
function sort_by_column (&$array_ref, $column) {
if (!empty($column)) {
usort($array_ref, function ($a, $b) {