ma più che funzione basta una hashtable

http://it.php.net/manual/en/language.types.array.php

qualcosa tipo:
codice:
$categoryImages = array
(
    '1s' => 'star_little.gif',
    '2s' => 'star_little2.gif',
    '3s' => 'star_little3.gif',
    '4s' => 'star_little4.gif',
    '5s' => 'star_little5.gif'
);
cosi poi per usarlo fai

codice:
$img_cat = $categoryImages[$row['categoria']];