I have pairs of items in an PHP array. Example:
<?php
$elements = array(
tiger => lion ,
car => bike ,
lion => zoo ,
truck => plane
);
?>
Now I want to combine these items so that all items which are connected in any way go to one group. Continuation of the example above:
<?php
$groups = array(
0=>array( tiger , lion , zoo ),
1=>array( car , bike ),
2=>array( truck , plane
);
?>
Is this understandable? How could I achieve this?
I m looking for a function which does this.