function str_multi_insert($inserts, $string)
{
// If the $inserts is not an array or there is nothing to insert, return the original string
if (!is_array($inserts) || count($inserts) == 0) {
return $string;
}
$strlen = strlen($string);
// Check for negative indices and handle them properly
foreach ($inserts as $index => $insert) {
if ($index < 0) {
$new_index = $strlen + $index;
// Still less than 0, so just make it 0
if ($new_index < 0) {
$new_index = 0;
}