Pluralize Function to change wording based on the number of results (0,1,or more)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function Pluralize($number, $plural, $singular) {
  2. if ($number == 1) {
  3. return $singular;
  4. } else {
  5. return $plural;
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.