每次以不同方式打印3个数组值

时间:2018-02-22 13:00:06

标签: php

很难在标题中解释这一点

我有不同的数组。让我们说这是数组:

library(vegan)
library(MASS)


row.names(Data) <- c("SI1", "SII0", "SI0", "SII2", "SI2", "SII1", "SIII0", "SIV2", "SIII2", "SIV1", "SIII1", "SIV0")
bcdist <- vegdist(Data, "bray")

bcmds <- isoMDS(bcdist, k = 2)


plot(bcmds$points, type = "n", xlab = "", ylab = "")

text(bcmds$points, dimnames(Data)[[1]])

如何打印此数组的每个可能的3个字符。 比如开始...

AAA

AAB

AAC

依旧......

2 个答案:

答案 0 :(得分:0)

你需要循环3来找到你想要的输出。

$char = 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","1","2","3","4","5","6","7","8","9","0");
$length = count($char);
for($i = 0; $i < $length; $i++)
    for($j = 0; $j < $length; $j++)
        for($k = 0; $k < $length; $k++)
            echo $char[$i].$char[$j].$char[$k]."<br/>";

输出:

aaa
aab
aac
aad
aae
aaf
aag
aah
aai
...

答案 1 :(得分:0)

这是可能的两个字母数字的例子

<?php
$start = base_convert("10",36,10);
$end = base_convert("zz",36,10);
for($start;$start <= $end;$start++){
  echo base_convert($start,10,36)."\n";
}
?>

Live Demo

您可以从100开始到zzz以获取三个字母数字的所有可能数字。