Skip to content

Instantly share code, notes, and snippets.

@LostKobrakai
Created February 2, 2015 17:27
Show Gist options
  • Save LostKobrakai/d09128adf13bbf588679 to your computer and use it in GitHub Desktop.
Save LostKobrakai/d09128adf13bbf588679 to your computer and use it in GitHub Desktop.
Combine each element to another.
<?php
$array = ["lot's", "of", "elements", "…"];
$allConcatinations = [];
for ($a=0; $a<count($array); $a++) {
for ($b=$a+1; $b<count($array); $b++) {
array_push($allConcatinations, $array[$a]." ".$array[$b]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment