The Little Guy Posted January 7, 2011 Author Share Posted January 7, 2011 That's ok. You can just use my native first name: dromodorialmakirvahumvete That will take for ever.... but its calculating.... I am 100% sure this could be done using a formula Quote Link to comment https://forums.phpfreaks.com/topic/223623-building-strings/page/2/#findComment-1156391 Share on other sites More sharing options...
QuickOldCar Posted January 7, 2011 Share Posted January 7, 2011 This just really shows how geeky php freaks we really are, ha ha. I just did this up so can do ranges in groups with being able to set lower and maximum limits for the groups. I only played with it a little bit, so just be careful with it, ehh, maybe set an extreme maximum limit to it or something. I was doing by letter and letter position amounts but I quit on it. Something like start from rrrr to rzzz or similar. <?php $group = mysql_real_escape_string($_GET['group']); if (!isset($_GET['group']) or $_GET['group'] == '') { $group = 1; } $lower = mysql_real_escape_string($_GET['lower']); $increase = mysql_real_escape_string($_GET['increase']); $alphabet_count = 26; $maximum_range = $alphabet_count*$group; $minimum_range = $maximum_range-25; $increase = $maximum_range+$increase; ?> <form name="input" action="" method="get"> Group:<input size="30"type="text" name="group" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $group; ?>"> Lower:<input size="30"type="text" name="lower" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $lower; ?>"> Increase:<input size="30"type="text" name="increase" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $increase; ?>"> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Set" /> </form> <?php function seqAlphabet($numbers) { $alphabet = ''; while($numbers >= 1) { $numbers = $numbers - 1; $alphabet = chr(($numbers % 26)+97) . $alphabet; $numbers = $numbers / 26; } return $alphabet; } $string_position = range($lower,$increase); foreach ($string_position as $position) { echo seqAlphabet($position) . "<br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/223623-building-strings/page/2/#findComment-1156401 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.