File "arrays.php"

Full Path: /www/wwwroot/shphe-en.com/wp-content/plugins/admin-columns-pro/codepress-admin-columns/includes/arrays.php
File size: 525 bytes
MIME-type: --
Charset: utf-8

<?php
/**
 * Replace a single key in an associative array
 *
 * @since 2.2.7
 *
 * @param array $input Input array.
 * @param int|string $oldkey Key to replace.
 * @param int|string $newkey Key to replace $oldkey with
 */
function cpac_array_key_replace( $input, $oldkey, $newkey ) {

	$keys = array_keys( $input );

	$oldkey_position = array_search( $oldkey, $keys );

	if ( $oldkey_position === false ) {
		return $input;
	}

	$keys[ $oldkey_position ] = $newkey;

	return array_combine( $keys, array_values( $input ) );
}