You shouldn't use eregi since it has been deprecated and will be completely removed from PHP 6. Stick to the PCRE functions. In this case, it would be preg_match or preg_match_all with the pattern modifier i. And the predefined character class is alnum, not alum.
So at first glance your pattern should be
$p = '#^[[:alnum:]]{4,20}$#i'; // modifier i for case insensitive
Howeer, since [:alnum:] contains both upper and lower case characters, you don't need to perform a ci match.
So this would do fine.
$p = '#^[[:alnum:]]{4,20}$#';