I want to check value with in range or not suppose if I have range D1 to D40 and if I enter D20 then it returns value with in range.
I check several solution but this are for only integer not for both string and integer.
EDIT
Range will be dynamic like AA20 to AA30 or like AC10D to AC30D
You can write something simpler like this...
$arr = range(1,40); //<--- Creating a range of 1 to 40 elements..
array_walk($arr,function (&$v){ $v = 'D'.$v;}); //<--- Concatenating D to all the elements..
echo in_array('D20',$arr) ? 'Found' : 'Not Found'; //<-- The search part.
Demonstration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With