It can be good to nest them, because by changing the order you may be able to avoid making extra comparisons. What you are doing now looks good, however your function would be less efficient if you instead wrote it as:
function change_password($email, $password, $new_password, $confirm_new_password)
{
if($new_password == $confirm_new_password && $email && $password && $new_password && $confirm_new_password)
{
if(login($email, $password))
{
if(set_password($email, $new_password))
{
return TRUE;
}
}
}
}
If $new_password == $confirm_new_password is true, but $email is empty, you will have made an extra comparison.
As others have said, there are other ways to go about this without nesting everything, which will be functionally equivalent.