If value is greater/lesser than xyz If value is greater/lesser than xyz php php

If value is greater/lesser than xyz


The sanest, neatest and most widely used syntax for if conditions in PHP is:

if($value >=500 && $value <=600 ){  echo "value is between 500 and 600";}


if ($count >= 0 && $count < 100) {    echo 'between 0 et 99';} elseif ($count < 199) {    echo 'between 100 and 199';} elseif { ...}elseif ($count < 599) {    echo 'between 500 and 599';} else {    echo 'greater or equal than 600';}


I wrote something like this a few years back (might be a better way to do it):

function create_range($p_num, $p_group = 1000) {    $i = 0;    while($p_num >= $i) {        $i += $p_group;    }    $i -= $p_group;    return $i . '-' . ($i + $p_group - 1);}print 'The number is between ' . create_range(502, 100) . '.';

It'll say 500-599, but you can adjust it to your needs.