如果是elseif条件

I want to display a series of outputs by using while loop and if condition, but here the if condition only works and the other conditions like elseif and else are not working. Please help me.

This is my code

    if($expid=='3606' OR '3660' OR '3661' OR '3662' OR '3684' OR '3685')
    { 
        $exp='1';
    }
    elseif($expid=='3607' OR '3608' OR '3612' OR '3620' OR '3621' OR '3622' OR '3623' OR '3624' OR '3625' OR '3626' OR '3636' OR '3646' OR '3647' OR '3648' OR '3649' OR '3650' OR '3651' OR '3652' OR '3653' OR '3654' OR '3655' OR '3656' OR '3657' OR '3658' OR '3659' OR '3605')
    {
        $exp='2';
    }
    elseif($expid=='3609' OR '3610' OR '3611' OR '3613' OR '3614' OR '3615' OR '3616' OR '3617' OR '3618'  OR '3619' OR '3627' OR '3628' OR '3629' OR '3630' OR '3631' OR '3632' OR '3633' OR '3634' OR '3635' OR '3637' OR '3638' OR '3639' OR '3640' OR '3641' OR '3642' OR '3643' OR '3645')
    {
        $exp='3';
    }
    elseif($expid=='3666' OR '3667' OR '3668' OR '3669' OR '3670' OR '3671' OR '3672' OR '3673' OR '3674' OR '3675' OR '3676' OR '3677' OR '3678' OR '3679' OR '3680' OR '3681' OR '3682' OR '3683')
    {
        $exp='4';
    }
    else{
        $exp='5';
    }
}
?>

$expid=='3606' OR '3660' OR '3661' OR '3662' OR '3684' OR '3685' will always be true because '3660' is evaluated as true.

But you may need to reconsider your logic and not do hard coding this numbers.

if($expid=='3606' || $expid=='3660' || $expid=='3661' || $expid=='3662' || $expid=='3684' || $expid=='3685')
    { 
        $exp='1';
    }

like this you have evaluate each expresion to return true or false

Because you are doing it wrong. Simply use in_array instead, to avoid confusion.

if(in_array($expid,array('3606','3660','3661','3662','3684','3685')))
{

You need to do something like this. Your OR statement is just a string. '3660' will always be true. you have to do $expid==3660, and the same goes for all of your other OR clauses.

if($expid=='3606' OR '$expid==3660' OR $expid=='3661' OR $expid=='3662' OR '$expid==3684' OR $expid=='3685')