<?php
function number_to_emoji($number) {
$digits = str_split($number);
$emoji = "";
foreach ($digits as $digit) {
$emoji .= emoji_digit($digit);
}
return $emoji;
}
function emoji_digit($digit) {
$digit_emojis = array(
'0' => '0⃣', // 0️⃣
'1' => '1⃣', // 1️⃣
'2' => '2⃣', // 2️⃣
'3' => '3⃣', // 3️⃣
'4' => '4⃣', // 4️⃣
'5' => '5⃣', // 5️⃣
'6' => '6⃣', // 6️⃣
'7' => '7⃣', // 7️⃣
'8' => '8⃣', // 8️⃣
'9' => '9⃣', // 9️⃣
);
return $digit_emojis[$digit];
}
// Teste
echo number_to_emoji(123);
?>
Created
April 11, 2023 21:17
-
-
Save kevineduardo/130274eb79b22ecaaa5aac222ba526cf to your computer and use it in GitHub Desktop.
PHP Int Number to Emoji Script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment