array_slice
array_slice — Extract a slice of the array.Description
array_slice( array $array,array_slice() returns the sequence of elements from the array array as specified by the offset and length parameters.
int $offset,
?int $length = null,
bool $preserve_keys = false ): array
Parameters
array
The input array.
offset
The offset to start from.
length
The length of the slice.
preserve_keys
Whether or not to preserve keys.
Return Values
Returns the slice. If the offset is larger than the size of the array, an empty array is returned.More information about array_slice on official PHP documentation site
array_slice - Popular snippets
- PHP 8.1 / MySQL 5.7 shuffle array_slice count print_r
last run:
2024-07-25 11:29:47
14
- PHP 8.1 / MySQL 5.7 array_slice array_search min array_sum var_dump
last run:
2024-01-30 09:35:16
12
- PHP 8.1 / MySQL 5.7 range shuffle array_slice implode
last run:
2024-12-06 17:29:42
9
- PHP 8.1 / MySQL 8.0 array_search array_slice array_map
last run:
2024-02-29 10:22:47
8
- PHP 8.1 / MySQL 5.7 json_decode file_get_contents array_slice array_sum sizeof print_r
last run:
2023-10-13 16:06:27
8
- PHP 8.1 / MySQL 5.7 print_r array_slice
last run:
2022-08-05 03:47:45
7
- PHP 8.1 / MySQL 5.7 explode array_slice array_merge implode
last run:
2024-01-24 07:56:55
5
- PHP 8.1 / MySQL 5.7 str_split shuffle print_r array_slice
last run:
2022-11-12 16:29:07
5
- PHP 7.4 / MySQL 5.7 shuffle print_r array_slice
last run:
2022-07-02 09:05:31
5
- PHP 7.4 / MySQL 8.0 array_slice array_unique array_reverse print_r
last run:
2022-11-28 09:51:39
5
array_slice - New snippets
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:56:55
2
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export array_combine substr_replace range
added at:
2024-12-06 18:47:24
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:33:38
2
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:33:15
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:32:46
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:32:35
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:32:26
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:30:54
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:30:33
1
-
PHP 8.2.13 / MySQL 8.0 count shuffle array_push array_slice var_export
added at:
2024-12-06 18:30:05
1