-
-
Save parzibyte/79f2f9a815dfffb1e02e080c3af0ae4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://parzibyte.me/blog | |
$diccionario = [ | |
1 => 0, | |
2 => 0, | |
3 => 0, | |
4 => 0, | |
5 => 0, | |
]; | |
$miArray = [1, 2, 1, 3, 3, 1, 2, 1, 5, 1]; | |
foreach ($miArray as $numero) { | |
$diccionario[$numero]++; | |
} | |
foreach ($diccionario as $clave => $conteo) { | |
echo "$clave: "; | |
for ($x = 0; $x < $conteo; $x++) { | |
echo "*"; | |
} | |
echo "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment