Getting first 3 values of an array in PHP
arrays, php
Solution
$firstThreeElements = array_slice($array, 0, 3);
Where 0 is your offset and 3 is the number of elements you want.
Problem
Suppose I have an array that looks like this ``` array ([apple] => 1, [dog]=>2, [cat]=>5, [bread]=>9, [shoes]=> 4) ``` Is it possible for me to print the first 3 values of the array? If so, how? Any ideas?