Source Code:
(back to article)
<?php $names = ['John', 'Mary', 'Peter', 'David', 'Sarah']; $replacement = ['Alex', 'Olivia']; array_splice($names, 2, 2, $replacement); print_r($names); ?>
Result:
Report an issue