Created
February 17, 2016 03:14
-
-
Save d30jeff/c136480bf9852c5680a1 to your computer and use it in GitHub Desktop.
Ok tak soalan nie sebagai internship interview question? In a string containing many words, find the longest word.
This file contains hidden or 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 | |
$arr = ['a', 'bc', 'def', 'longest']; | |
usort($arr, function($a, $b) { | |
return strlen($b) - strlen($a); | |
}); | |
echo $arr[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
alamak tak boleh la pulak guna max... -_-