Skip to content

Commit

Permalink
Fix space as last character
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchantastic committed Jul 3, 2018
1 parent e0718e7 commit 4b46b9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ function characters($count) {
$words = implode(' ', $words_array);
$words = substr($words, 0, $count);

$last_character = substr($words, -1);

if ($last_character === ' ') {
$words = substr($words, 0, -1) . substr($lipsum->word(), 0, 1);
}

return $words;
}

Expand Down

0 comments on commit 4b46b9b

Please sign in to comment.