Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.
Do more with
foreach($ar1 as $value)
{
echo $value[from];
if (is_array($value)
foreach($value as $innerValue)
{
echo $innerValue;
{
}
<?php
// Our initials
$Values = array(
array(10,20,30),
array(10,20,30,40),
array(10,20,30),
array(10,20,30,99)
);
// Create an array to store the combos
$Combinations = array();
getCombos("",$Values,$Combinations);
function getCombos($Combination,$Values,&$Combinations)
{
if(count($Values))
{
$set = array_shift($Values);
foreach($set as $el)
{
$NewCombination = $Combination . "," . $el; // Continue creating the next combination
getCombos($NewCombination,$Values,$Combinations); // Recurse with our new combo
}
}
else
{
$Combinations[] = substr($Combinationm,1); // Save combo without leading comma
}
}
// Show the combos
print_r($Combinations);
?>
Premium Content
You need an Expert Office subscription to comment.Start Free Trial