הרשם שאלות ותשובות רשימת חברים לוח שנה חיפוש הודעות מהיום סמן פורומים כנקראו

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 22-01-07, 20:48   # 1
LiDooR
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Apr 2006
הודעות: 79

LiDooR לא מחובר  

הינה הקוד הנכון באמת..

אומנם זה לקח לי קצת זמן אבל בסוף הגעתי ליעד שרציתה..
לפחות כך אני מכווה..
חחח..
הינה הקוד:
PHP קוד:
<?

for ($num=1$num<=9$num++) 

    for (
$bigtext=A$b=1$bigtext<=&& $b<=26$bigtext++, $b++)
    {
        for (
$text=a$c=1$text<=&& $c<=26$text++, $c++)
        {
            echo 
"$num$bigtext$text<br>";
        }
    }
}

?>
והינה חלק מהפלט שלו:
ציטוט:
1Aa
1Ab
1Ac
1Ad
1Ae
1Af
1Ag
1Ah
1Ai
1Aj
1Ak
1Al
1Am
1An
1Ao
1Ap
1Aq
כך בעצם הוא ימשיך עד שהוא יגיע ל 9Zz ושם הוא יעצור..
עד שהוא יגיע לשם הוא ידפיס לך 6084 קודים.. שאני מאמין שזה יספיק לך.. לא?..
מכווה שעזרתי אחי..
  Reply With Quote
ישן 22-01-07, 20:55   # 2
בניה
משתמש - היכל התהילה
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: נחושה
הודעות: 3,434

בניה לא מחובר  

PHP קוד:
<?php
error_reporting
(E_ALL);
class 
generator
{

    
/**
    * Chars array
    *
    * The list of the Chars of the strings
    *
    * @access private
    * @var Char array
    */
    
var $tags;

    
/**
    * Tags num
    *
    * The num of the Tags in the tags array
    *
    * @access private
    * @var int
    */
    
var $tags_num;

    
/**
    * code array
    *
    * The current array that contain the chars of the generator output
    *
    * @access private
    * @var string
    */
    
var $code;




function 
generator$start_length )
{
    for(
$i=1$i<=$start_length$i++)
        
$this->code[]=0;
    
$this->tags=array
    (
        
"1","2","3","4","5","6","7","8","9","0",
        
"a","b","c","d","e","f","g","h","i","g","k","l","m"
        
,"n","o","p","q","r","s","t","u","v","w","x","y","z"
    
);
    
$this->tags_num=count($this->tags);
    
$this->update_key=0;
}
function 
next_code()
{
    if(
$this->code[$this->update_key]>=$this->tags_num-1)
    {
        for(
$i=0$i<=$this->update_key$i++ )
            
$this->code[$i]=0;
        
$this->update_key++;
        
$this->code[]=-1;
        
$this->next_code();
        
$this->update_key=0;
    }
    else
    {
        
$this->code[$this->update_key]++;
    }
}
function 
get_code()
{
    
$thecode "";
            foreach(
$this->code as $key=>$value)
            {
                
$thecode.= ($this->tags[$value]);
            }
    
$this->next_code();
    return 
strrev($thecode);
}

}

$codes = new generator();
for(
$l=1$l<=10$l++)
    {
        echo 
$codes->get_code()."<br />";
    }
?>
אם אתה רוצה שהקוד יתחיל ממחרוזת בגודל יותר גדול מ1 אז תעביר את הגודל הרצוי כפרמטר לפונקציה generator ככה:

PHP קוד:
$codes = new generator(4); 
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 

כלים לאשכול
תצורת הצגה

חוקי פירסום
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 מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 13:36.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ