I look for "a aa aaa aab" script :)
01-20-2009, 06:27 PM
|
I look for "a aa aaa aab" script :)
|
Posts: 10
|
Hi,
I try do this script, but my skill is for this too small
I have some array for example:
a = 135, aa = 150, aaa = 10, aab = 1500...
I need some class which look on first word and when word's number is over 100 save this on db a add next letter in alphabet. When is number under 100 (in my example aaa) i would word change from aaa to aab. This class will be work until word isn't zzz.
Have anybody some idea how do it?
Thank you!
|
|
|
|
01-20-2009, 07:51 PM
|
Re: I look for "a aa aaa aab" script :)
|
Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
|
I really have no idea what you're trying to do.
could you try rephrasing your question? it's rather confusing the way you put it 
|
|
|
|
01-21-2009, 05:49 AM
|
Re: I look for "a aa aaa aab" script :)
|
Posts: 10
|
I have the words and numbers in array ("a = 150","aa = 130","aaa = 15","aab = 1350"...).
The script starts with the word "a". If the number of words is bigger than 100 script saves the word and number in db and goes to the next word (aa) and another (aaa).
Number words "aaa" is less than 100 soo script this word skip and change the last letter in the alphabet for next (aaa -> aab).
If will word is aaz script will be continue with ab.
My english is bad, sorry
Thank you.
Last edited by digi; 01-21-2009 at 06:18 AM..
|
|
|
|
01-21-2009, 06:31 AM
|
Re: I look for "a aa aaa aab" script :)
|
Posts: 41
Name: Madars
Location: Latvia
|
I'm not sure, but as I understand you need to extract strings where number is larger than 100?
PHP Code:
<?php $strings = array("a = 150","aa = 130","aaa = 15","aab = 1350");
foreach ($strings as $string) { list($word,$number)= explode(' = ',$string); if($number>100) { echo $word . ' equals ' . $number . '<br />'; //do something with $word or $number } } ?>
|
|
|
|
01-21-2009, 08:27 AM
|
Re: I look for "a aa aaa aab" script :)
|
Posts: 10
|
Thank you, but now I see that I have to explain wrong
I have a script that gives me the words in array www.example.com/script.php?word=a.
Now script returned me array with word "a" and his number. I don't know how many words are in DB, soo I go from "a" to "zzz" (when are their numbers bigger then 100).
I don't know only how check from "a" to "zzz". What I do for this moment
PHP Code:
$letter = array (1 => "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
$letters = $letter[1];
if ($number >= '100') {
echo $word.' - '.$number."<br>";
$letters = $letter.$letter[1];
} else {
echo $word.' has only '.$number."<br>";
$letters = $letter[1+1];
}
Thanks
|
|
|
|
01-21-2009, 04:54 PM
|
Re: I look for "a aa aaa aab" script :)
|
Posts: 10
|
I DO IT!
It's ugly bad noobish script, but it works!
PHP Code:
$letter = array (1 => "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");
$letters = $letter[1];
$order = '1';
$q_stat = 'plus';
if ($number >= '1') {
if ($q_top == '26') {
$q_top == '1';
$order = '1';
}
$letters = $letters.$letter[$order];
mysql_query("
INSERT INTO words (id, word, number)
values ('', '$word', '$number');
");
$q_stat = 'plus';
} else {
if ($q_stat == 'plus') {
$order = '1';
$letters = substr($letters, 0, -1).$letter[$order];
} else {
if ($order >= '26') {
$order = '1';
$order = array_search(substr($letters, -2, -1), $letter)+'1';
$letters = substr($letters, 0, -2).$letter[array_search(substr($letters, -2, -1), $letter)+'1'];
$q_top = '26';
} else {
$order = $order+'1';
$letters = substr($letters, 0, -1).$letter[$order];
}
}
$q_stat = 'minus';
}
Thank you 
|
|
|
|
|
« Reply to I look for "a aa aaa aab" script :)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|