As far as I know there are 2 ways:
if (test)
{header("Location: whatever.php");}
This must be done BEFORE u send any other headers to the client. (meaning: before u write anything to the page, including PHP errors and warnings)
U can also use this:
if (test)
{echo "<script language=\"Javascript\">location.replace('whatever.php')</script>";}
This can be used anywhere, but since it's Javascript the page will have to load before redirecting, which makes it considerably slower.
Hope that helps.