Skip to content

Instantly share code, notes, and snippets.

@roy-bukapeta
Created June 27, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roy-bukapeta/a17b1ff138e5dcd5d75e005e438b96dd to your computer and use it in GitHub Desktop.
Save roy-bukapeta/a17b1ff138e5dcd5d75e005e438b96dd to your computer and use it in GitHub Desktop.
Challenge #2
<?php
function VowelSquare($strArr)
{
$vowel = ['a','i','u','e','o'];
for ($i=0; $i < count($strArr); $i++) {
$arr1[$i] = str_split($strArr[$i]);
for ($in=0; $in < count($arr1[$i]); $in++) {
$arr2[$i][$in] = $arr1[$i][$in];
}
};
for ($i=0; $i < count($arr2); $i++) {
for ($in=0; $in < count($arr2[$i]); $in++) {
if ($i < (count($arr2) - 1) && $in < (count($arr2[$i]) - 1)) {
if (in_array($arr2[$i][$in], $vowel) && in_array($arr2[$i][($in + 1)], $vowel) && in_array($arr2[($i + 1)][$in], $vowel) && in_array($arr2[($i + 1)][($in + 1)], $vowel)) {
return $i . '-' . $in;
}
}
}
}
return 'not found';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment