cry of war Posted December 4, 2007 Share Posted December 4, 2007 When I use range() I under stand how to make it select all numbers that start with 1-9 and so on and the same with letters but how do I make it find all the following and anything else one might think up.. ~ ! @ # $ % ^ & * ( ) _ + ` - = { } | [ ] \ : " ; ' < > ? , . / I have tried stuff like range('A','z') gives you all Caps letters + 5 characters + all lower case letters I was more looking for All characters + All caps. I searched the web and all I could find is them telling you about ranges incremental part but I have no use for that Thanks for any help CoW Edit: almost forgot here is the example of where im trying to use it foreach (range('A','z') as $ltr) {/*this is the part i need help with*/ $tmp[] = '\n<optgroup label='.strtoupper($ltr).'>'; $q = "SELECT * FROM `$table6` WHERE `Name` LIKE '" . $ltr . "%' ORDER BY `Name`"; $result = mysql_query($q) or die("Problem with the query: $q<br/>" . mysql_error()); if (mysql_num_rows($result) == 0){ $tmp[] = "\n<option value=''>No Items</OPTION>"; } else { while ($row = mysql_fetch_assoc($result)) { $tmp[] = "\n<option value='".$row['ID']."'>".$row['Name']."</OPTION>"; } } $tmp[] = "\n</OPTGROUP>"; } Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted December 4, 2007 Share Posted December 4, 2007 chr() is your friend: <?php foreach(range(33,126) as $v){ echo chr($v).'<br />'; } ?> Quote Link to comment Share on other sites More sharing options...
cry of war Posted December 4, 2007 Author Share Posted December 4, 2007 ahhh its perfect = P thank you so much was wondering if there was a way to use hexadecimal in php Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 4, 2007 Share Posted December 4, 2007 there are base conversion function such as dec2hex or dec2octal look it up on php.net 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.