File Manager / wp-content Search Upload New Item Settings File "db5.php" Full path: /home1/epichome/public_html/wp-content/db5.php File size: 60.67 B (60.67 KB bytes) MIME-type: text/x-php Charset: utf-8 Download Open Edit Advanced Editor Back
/home/pharmacy/www/wp-content/plugins/so-widgets-bundle/base/inc/array-utils.php
<?php

/**
 * From this SO answer by Halil Özgür: https://stackoverflow.com/a/18781630/3710600
 *
 * Works with both integer and string positions.
 *
 * @param array      $array
 * @param int|string $position
 * @param mixed      $insert
 */
function siteorigin_widgets_array_insert( &$array, $position, $insert ) {
	if ( is_int( $position ) ) {
		array_splice( $array, $position, 0, $insert );
	} else {
		$pos = array_search( $position, array_keys( $array ) );
		$array = array_merge(
			array_slice( $array, 0, $pos ),
			$insert,
			array_slice( $array, $pos )
		);
	}
}