Skip to content

Instantly share code, notes, and snippets.

@saeedsajadi
Created August 6, 2017 13:59
Show Gist options
  • Save saeedsajadi/931358399be55a617ccb674fdc26471d to your computer and use it in GitHub Desktop.
Save saeedsajadi/931358399be55a617ccb674fdc26471d to your computer and use it in GitHub Desktop.
<?php
$arr = [
['R1', 'R2', 'R3'],
['A1', 'A2', 'A3'],
['M1', 'M2']
];
$result = [""];
foreach ($arr as $item) {
$tmp = [];
foreach ($item as $el) {
foreach ($result as $curr) {
array_push($tmp, $curr . $el);
}
}
$result = $tmp;
}
echo json_encode($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment