Created
July 15, 2021 23:47
-
-
Save lomotech/7bad60b3315e8c4ff857d13eb5517587 to your computer and use it in GitHub Desktop.
array test
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
// 1. Given an array of [4,1,5,6], write a function that returns to me the lowest number. | |
// 2. Given an array of strings ['apple', 'banana', 'orange', 'apple'], return an object with the count of each element in the array. | |
{ 'apple': 2, 'orange': 1, 'banana': 1 }. | |
$a = [4,1,5,6] | |
sort($a) | |
$a[0] | |
$b = ['apple', 'banana', 'orange', 'apple'] | |
json_encode(array_count_values($b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment