Plural Standards
Date: 09/13/06
(PHP Community) Keywords: php
What's the approriate way to do plurals in PHP with/without a template system?
For example, you have the variable $num
, and you want to echo out You have $num peaches
. Or something. Right now I do:
echo 'You have ' . $num . ' peach' . ($num!=1 ? 'es' : '') . '.';
but I can imagine that's not the proper way to do things.
Sure, it's not a problem for most of us, but I'm considering switching to a template program of sorts soon, and wonder if there is a standard we should be following
Source: http://community.livejournal.com/php/494731.html