PHP。根据比较的数量重复数组值

时间:2017-02-24 02:11:06

标签: php

THIS MESSAGE

我尝试在PHP中循环,但它没有工作

重复字符串,直到达到消息的长度。

1 个答案:

答案 0 :(得分:0)

这是代码

 private function initiate_encryption() // BREAKING DOWN THE MESSAGE INTO ARRAY 
    {
        for($a = 0; $a < count($this->raw_message); $a ++)
        {
            $this->raw_msg_brkdown[$a] = array_search($this->raw_message[$a],$this->set); // ASSIGNING DATA TO ARRAY ACCORDING TO ALP
        }
        return $this->mix_passprase();
    }

    private function mix_passprase() // BREAKING DOWN THE PASSPHRASE INTO AN ARRAY AND ASSIGNING VALUE 
    {            
        for($a = 0; $a < count($this->passphrase); $a ++)
        {
            $this->raw_pass_brkdown[$a] = array_search($this->passphrase[$a],$this->set); // ASSIGNING DATA TO ARRAY ACCORDING TO ALP
        }
        return $this->mix_elements();
    }

    private function mix_elements() // THE MOMENT OF TRUTH 
    {   
        $str  = count($this->raw_message);
        $pass = count($this->passphrase);

        for($a = 0; $a < $pass; $a += $str)
        {
            echo $a;
        }
    }