Reply
I look for "a aa aaa aab" script :)
Old 01-20-2009, 06:27 PM I look for "a aa aaa aab" script :)
Novice Talker

Posts: 10
Trades: 0
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!
digi is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 01-20-2009, 07:51 PM Re: I look for "a aa aaa aab" script :)
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
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
__________________
Will Anderson
It's An Anderson | Twitter | Anderson Web Solutions
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 01-21-2009, 05:49 AM Re: I look for "a aa aaa aab" script :)
Novice Talker

Posts: 10
Trades: 0
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..
digi is offline
Reply With Quote
View Public Profile
 
Old 01-21-2009, 06:31 AM Re: I look for "a aa aaa aab" script :)
Mad182's Avatar
Experienced Talker

Posts: 41
Name: Madars
Location: Latvia
Trades: 0
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
    
}
}
?>
__________________
There's no place like 127.0.0.1
latvian guitar chords | runescape community
Mad182 is offline
Reply With Quote
View Public Profile Visit Mad182's homepage!
 
Old 01-21-2009, 08:27 AM Re: I look for "a aa aaa aab" script :)
Novice Talker

Posts: 10
Trades: 0
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 (=> "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
digi is offline
Reply With Quote
View Public Profile
 
Old 01-21-2009, 04:54 PM Re: I look for "a aa aaa aab" script :)
Novice Talker

Posts: 10
Trades: 0
I DO IT!

It's ugly bad noobish script, but it works!

PHP Code:
$letter = array (=> "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($letters0, -1).$letter[$order];
  } else {
    if (
$order >= '26') {
      
$order '1';
 
      
$order array_search(substr($letters, -2, -1), $letter)+'1';
      
$letters substr($letters0, -2).$letter[array_search(substr($letters, -2, -1), $letter)+'1'];

      
$q_top '26';
    } else {
      
$order $order+'1';
      
$letters substr($letters0, -1).$letter[$order];
    }
  }

  
$q_stat 'minus';


Thank you
digi is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I look for "a aa aaa aab" script :)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13194 seconds with 13 queries