Arrays in PHP sny
array_spliceЗадание 1
Gegewe array:
php<?php
$arr = [1, 2, 3, 4, 5];
?>
Sny elemente daaruit uit, sodat die array soos volg lyk:
php<?php
[1, 4, 5]
?>
Задание 2
Gegewe array:
php<?php
$arr = [1, 2, 3, 4, 5];
?>
Verkry die volgende sny uit hierdie array:
php<?php
[2, 3, 4]
?>
Задание 3
Gegewe array:
php<?php
$arr = [1, 2, 3, 4, 5];
?>
Voeg nuwe elemente by hierdie array:
php<?php
[1, 2, 3, 'a', 'b', 'c', 4, 5]
?>
Задание 4
Gegewe array:
php<?php
$arr = [1, 2, 3, 4, 5];
?>
Voeg nuwe elemente by hierdie array:
php<?php
[1, 'a', 'b', 2, 3, 4, 'c', 5, 'e']
?>