efficacious Posted August 15, 2008 Share Posted August 15, 2008 hello everyone, can anyone tell me why only two of these would be parsed? if($_SESSION['ID']=='2' || $_SESSION['ID']=='1' || $_SESSION['ID']=='3' || $_SESSION['ID']=='4') for some reason only 2 of these the first ones are parsed.. i'm at a loss as to why thanks for you suggestions, eff Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/ Share on other sites More sharing options...
kenrbnsn Posted August 15, 2008 Share Posted August 15, 2008 How can you tell that? You probably want to write that "if" statement this way: <?php if (in_array($_SESSION['ID'],array('1','2','3','4')) ?> Ken Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/#findComment-617614 Share on other sites More sharing options...
efficacious Posted August 15, 2008 Author Share Posted August 15, 2008 nice I think that me EXACTLY what i'm looking for thanks a million ken Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/#findComment-617615 Share on other sites More sharing options...
efficacious Posted August 15, 2008 Author Share Posted August 15, 2008 Wait wouldn't session ID have to be an array first? Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/#findComment-617617 Share on other sites More sharing options...
kenrbnsn Posted August 15, 2008 Share Posted August 15, 2008 No, the in_array() function sees whether the value in the first parameter is in the array in the second parameter. See in_array() Ken Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/#findComment-617618 Share on other sites More sharing options...
Jabop Posted August 15, 2008 Share Posted August 15, 2008 Even though your initial function would still work... Link to comment https://forums.phpfreaks.com/topic/119889-too-many-ors/#findComment-617620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.