Skip to content

Commit

Permalink
Remove empty items, trim values
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshoerrmann committed Feb 16, 2023
1 parent d88d793 commit 15e2a6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@

function naturalList($data, $conjunction = false)
{
// Remove empty items, trim values
$data = array_map('trim', array_filter($data));

if ($conjunction === false) {
return implode(', ', $data);
}
Expand All @@ -259,6 +262,9 @@ function numericList($data, $period = true)
return $list;
}

// Remove empty items, trim values
$data = array_map('trim', array_filter($data));

$numbers = [];
foreach ($data as $value) {
$numbers[] = intval(strip_tags($value));
Expand Down

0 comments on commit 15e2a6e

Please sign in to comment.