<?php $strleft = ''; if ($days){ $strleft .= "$days Day".($days != 1 ? 's' : ''); } $strleft .= ($days ? ' ' : '')."$hours Hr".($hours != 1 ? 's.' : '.'); if(!$type){ return $strleft; }else{ return $strleft." $minutes Min".($minutes!=1 ? 's.' : '.'); } ?>
Próbowałem zrobić to funkcją if else ale dawało efektów (wyświetlało wszędzie "1" jako ilość dni i godzin). Tak to wyglądało:
<?php $strleft = ''; if ($days){ if ($days = 1){ $strleft .= "$days dzień"; } else { $strleft .= "$days dni"; } } $strleft .= ($days ? ' ' : '')."$hours Hr".($hours != 1 ? 's.' : '.'); if(!$type){ return $strleft; }else{ return $strleft." $minutes Min".($minutes!=1 ? 's.' : '.'); } ?>
Proszę pomóżcie..