Skip to content

Commit

Permalink
Add comment about oneline solution in PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
petemcfarlane committed Jun 9, 2016
1 parent 7de7f47 commit 4e12fa2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions PHP/src/AsciiNumberTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public function translate($ascii)

return implode($numbers);

/*
The above could be written in one line, but I don't think
this is very clear to read in PHP because of the syntax,
so I chose to introduce intermediary local variables.
*/
return implode(array_map(function ($char) {
return $this->translate($char);
}, array_map('implode', transpose(array_map(function ($line) {
Expand Down

0 comments on commit 4e12fa2

Please sign in to comment.