get only first 3 elemnter of array php code example Example: php array get first x elements $sliced_array = array_slice($array, 0, 5)