Reputation: 320
if
(
($page_num >=10 && $page_num<= 20) ||
($page_num >= 21 && $page_num =< 30) ||
($page_num >=31 && $page_num =<40)
){
if($i==1){
$i = $page_num;
}
}
I am trying to achieve multiple conditionals using the above in PHP. I tried it and it kept outputting an error, so I don't know if I am making a mistake or what I am trying above is not possible in PHP or programming.
The error message
Parse error: syntax error, unexpected '<' in C:addsdcredit.php on line 398
Upvotes: 0
Views: 52
Reputation: 1580
You have =< on your code, change them like this: <= . check http://php.net/manual/fa/language.operators.precedence.php. Hope it helps.
$page_num = 11;
$i=1;
if(($page_num >=10 && $page_num<= 20) || ($page_num >= 21 && $page_num <= 30) || ($page_num >=31 && $page_num <=40)){
if($i==1){
$i = $page_num;
}
}
Upvotes: 3