1. [PHP]代码
<?php function combination(){ $array = array(); $arguments = func_get_args(); foreach($arguments as $argument){ if(is_array($argument) === true){ $array[] = $argument; }else{ $array[] = array($argument); } } $size = count($array); if($size === 0){ return array(); }else if($size === 1){ return is_array($array[0]) === true ? $array[0] : array(); }else{ $result = array(); $a = $array[0]; array_shift($array); if(is_array($array) === false){ return $result; } foreach($a as $val){ $b = call_user_func_array("combination", $array); foreach($b as $c){ if(is_array($c) === true){ $result[] = array_merge(array($val), $c); }else{ $result[] = array($val, $c); } } } return $result; } } print_r(combination(array("A1", "A2"), array("B1", "B2"), "1", array("C1", "C2", "C3"))); ?>
Statement
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
2 weeks agoByDDD
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment