Created
June 27, 2018 17:13
-
-
Save roy-bukapeta/a17b1ff138e5dcd5d75e005e438b96dd to your computer and use it in GitHub Desktop.
Challenge #2
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 | |
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