Created
April 5, 2017 08:36
-
-
Save akutaktau/8c0cb658d6413b338d2f1b9e794234a7 to your computer and use it in GitHub Desktop.
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 | |
echo '<pre>'; | |
$arr1 = ['1','2','3','4']; | |
$arr2 = ['1','2','3','3','4','4','5','5','6','6','7','8','9']; | |
//done 1 | |
$arr1Low = arsort($arr1); | |
print_r($arr1Low); | |
echo '<br />'; | |
//done 2 | |
$arr2Unique = array_unique($arr2); | |
print_r($arr1Low); | |
echo '<br />'; | |
//done 3 | |
print_r(min($arr2Unique)); | |
echo '<br />'; | |
//done 4 | |
print_r(max($arr2Unique)); | |
echo '<br />'; | |
//done 5 | |
print_r(array_count_values($arr2)); | |
echo '<br />'; | |
//done 6 | |
$string = 'Ali Bin Abu'; | |
$strArray = explode(' ',$string); | |
echo $strArray[2].' '.$strArray[1]. ' ' . $strArray[0]; | |
echo '<br />'; | |
//done 7 | |
$print = 0; | |
for ($i = 1; $i<=100; $i++) { | |
if($i%3 == '0'){ | |
echo 'Buzz,'; | |
$print = 1; | |
} | |
if($i%5 == '0') { | |
echo 'Lightyear,'; | |
$print = 1; | |
} | |
if($print == 0) | |
echo $i.','; | |
$print = 0; | |
} | |
//done 9 | |
//sebab code atas kalau 15 dah print buzzlightyear | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment