字符结合类型的题目

WBOY
Release: 2016-06-13 13:13:31
Original
778 people have browsed it

字符组合类型的题目
题目如下:

有一串字符集,如:0123456789,现在需要任意用其中的字符,组成四位字符串,一共有:10*9*8*7种计算结果,现在怎样输出这些字符呢,谢谢。。

------解决方案--------------------
仅供参考

PHP code

printStr(str_split('012'));
function printStr($arr, $length = 4, $str = '')
{
    if(empty($arr) || !is_array($arr))
    {
        return;
    }
    foreach($arr AS $k=> $v)
    {
        $str    .= $v;
        if(strlen($str)';
        }
        $str    = substr($str, 0, -1);
    }
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!