Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Thurmond pthurmond

View GitHub Profile
@pthurmond
pthurmond / associative_array_splicer.php
Last active Apr 17, 2021
This is a tool to allow a programmer to easily insert a new associative index into a desired position in a PHP associative array.
View associative_array_splicer.php
<?php
/**
* Insert an associative array into a specific position in an array.
*
* @param array $original
* The original array to add to.
* @param array $new
* The new array of values to insert into the original.
* @param int $offset
* The position in the array ( 0 index ) where the new array should go.