alexislalas Posted May 18, 2009 Share Posted May 18, 2009 Hello, I have a pool of values I have to use, but I only have the first and last value of the range: 9CF90000-9CF910CB and I need all the values between them. How can I get them or generate them? Thanks!! Quote Link to comment Share on other sites More sharing options...
kickstart Posted May 18, 2009 Share Posted May 18, 2009 Hi $startNum = hexdec("9CF90000"); $endNum = hexdec("9CF910CB"); for($iCnt = $startNum; $iCnt <= $endNum; $iCnt++); { echo dechex($iCnt); } All the best Keith Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 18, 2009 Share Posted May 18, 2009 kickstart beat me to it, but I created a function (plus his has a typo because of the [ code ] tag), so I'll post mine anyway: <?php function getHexRange($start, $end) { $startDec = hexdec($start); $endDec = hexdec($end); $hexArray = array(); for($dec=$startDec; $dec<=$endDec; $dec++) { $hexArray[] = dechex($dec); } return $hexArray; } $range = getHexRange('9CF90000', '9CF910CB'); print_r($range); ?> Quote Link to comment Share on other sites More sharing options...
kickstart Posted May 18, 2009 Share Posted May 18, 2009 Whistles nonchalantly. All the best Keith Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.