Skip to content

Instantly share code, notes, and snippets.

@jackbravo
Created February 22, 2018 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackbravo/e8b6798289148a0684f0a41fd0cc74ee to your computer and use it in GitHub Desktop.
Save jackbravo/e8b6798289148a0684f0a41fd0cc74ee to your computer and use it in GitHub Desktop.
PHP Anagram exercise
<?php
/***
# Anagram clasification
## Concepts
Anagrams are words with exactly the same letters in different order
e.g., AMOR, ROMA, and MORA
## What we need
Write a function that...
- receives an Array of words
- prints the words found in the Array
- each set of anagrams on a line
- separate words with ' - '
## Example
```
//
// Given:
// ['AMOR', 'XISELA', 'JAMON', 'ROMA', 'OMAR', 'MORA', 'ESPONJA', 'RAMO', 'JAPONES', 'ARMO', 'MOJAN', 'MARO', 'ORAM', 'MONJA', 'ALEXIS']
==> Prints:
// AMOR - ROMA - OMAR - MORA - RAMO - ARMO - MARO - ORAM
// MONJA - JAMON - MOJAN
// ESPONJA - JAPONES
// ALEXIS - XISELA
```
***/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment