[Solved] How to choose range with php If condition [closed]


really just guessing here:

<?php

$i=23;//13,33,43,9999999993
if(substr($i,-1) == 3){ 
echo "there is 3";
}

the code

substr($i,-1)

returns the last character of the string $i


to cover 2 or 3 or 4

$i=24;
if(in_array(substr($i,-1),array(2,3,4))){ 
echo "ends in 2 or 3 or 4";
}

0

solved How to choose range with php If condition [closed]