array_slice()
function array_slice(array $array, int $offset, int $length = null, bool $preserve_keys = false): array
Extracts a slice of an array.
Parameters:
$array(array)$offset(int)$length(int), defaultnull, optional$preserve_keys(bool), defaultfalse, optional
Returns: array
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/array/array_slice.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how array_slice is implemented in the compiler, see the internals page.