Skip to content

Instantly share code, notes, and snippets.

@cahsowan
Last active August 29, 2015 14:10
Show Gist options
  • Save cahsowan/c987201635126a1f3a40 to your computer and use it in GitHub Desktop.
Save cahsowan/c987201635126a1f3a40 to your computer and use it in GitHub Desktop.
Hitung Jumlah Huruf Vocal
<?php
$name = 'taufik rahman';
echo $name;
echo "<br>";
$name_arr = str_split($name);
// AYO HITUNG JUMLAH HURUF VOCAL
$vocal = ['a','e','i','u','o'];
$found = array_intersect($vocal, $name_arr);
$count = array_count_values($name_arr);
$result = [];
foreach ($found as $item) {
$result[$item] = $count[$item];
}
var_dump($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment