Skip to content

Instantly share code, notes, and snippets.

@caferrari
Last active January 4, 2016 03:49
Show Gist options
  • Save caferrari/8564642 to your computer and use it in GitHub Desktop.
Save caferrari/8564642 to your computer and use it in GitHub Desktop.
<?php
$argc != 2 && exit('Use: php japaname.php yourname' . PHP_EOL);
$dict = explode(',', 'ka,tu,mi,te,ku,lu,ji,ri,ki,zu,me,ta,rin,to,mo,no,ke,shi,ari,chi,do,ru,na,mei,fu,ra');
$japaname = array_reduce(str_split($argv[1]), function ($r, $c) use ($dict) {
$chr = ord(strtolower($c)) - 97;
return $r . (array_key_exists($chr, $dict) ? $dict[$chr] : ' ');
});
echo $japaname . PHP_EOL;
// https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-prn2/10775_10151949245805892_1234658638_n.jpg
// PHP 5.4 required
// Use: php japaname.php yourname
// or: php japaname.php "Your Full Name"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment