|
|
|
|
|
by pixeloution
5388 days ago
|
|
<?php
$string = "aeiouxabcd";
$checkfor = array('a','e','i','o','u');
$count = 0;
for($x = 0; $x < strlen($string); $x++) {
if(in_array($string[$x], $checkfor)) {
$count++;
}
}
echo $count . "\n";
Am I hired? Or do I lose cool points for PHP? |
|
I'm all for intellectual gamesmanship, but these are our professional equivalent of a doctor being asked to identify the difference between blood and water. You can do it. We know. Demonstrating that you can do it is not the point of the exercise. We do it to have a cheap-to-administer test to exclude people-who-cannot-actually-program-despite-previous-job-titles from the expensive portions of the hiring process.