第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

生成所有案例 NUMBER LETTER NUMBER - php

生成所有案例 NUMBER LETTER NUMBER - php

PHP
波斯汪 2023-08-19 09:45:15
您好,我想按此順序列出該數(shù)組中所有可能情況的列表NUMBER LETTER NUMBER$a = array("0","1","2","3","4","5","6","7","8","9");$b = 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");$c = array("0","1","2","3","4","5","6","7","8","9");它將開始于0A0并以9Z9我嘗試過這樣的事情:foreach($a as $key1 => $first){    foreach($b as $key2 => $second){        foreach($c as $key3 => $third){            print_r($first[$key1].$second[$key2].$key3[$key3]);        }    }}但它不起作用,有什么幫助嗎?
查看完整描述

2 回答

?
精慕HU

TA貢獻1845條經(jīng)驗 獲得超8個贊

您的數(shù)組引用是錯誤的。對于一個簡單的數(shù)組,當使用 foreach 時,$key幾乎無關(guān)緊要,因為該出現(xiàn)的值將在$firstor中$second......


foreach($a as  $first){

    foreach($b as $second){

        foreach($c as $third){

            echo $first . $second . $third . PHP_EOL;

        }

    }

}

如果您在瀏覽器上輸出此內(nèi)容,請更改PHP_EOL為'<br>'


查看完整回答
反對 回復(fù) 2023-08-19
?
米琪卡哇伊

TA貢獻1998條經(jīng)驗 獲得超6個贊

你差不多解決了。你不需要在這里使用密鑰。這是代碼


<?php


$a = array("0","1","2","3","4","5","6","7","8","9");

$b = 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");

$c = array("0","1","2","3","4","5","6","7","8","9");


foreach($a as $first){

    foreach($b as $second){

        foreach($c as $third){

            echo ($first.$second.$third).PHP_EOL;

        }

    }

}


查看完整回答
反對 回復(fù) 2023-08-19
  • 2 回答
  • 0 關(guān)注
  • 132 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號