Tribe__Utils__Array::destringify_keys( array $input, string $prefix = 'sk_' )

The inverse of the stringify_keys method, it will restore numeric keys for previously stringified keys.


Parameters

$input

(<span class="arrayarray<int|">string,mixed>) (Required) The input array whose stringified keys should be destringified.

$prefix

(string) (Optional) The prefix that should be used to target only specific string keys.

Default value: 'sk_'


Top ↑

Return

(array<int|string,mixed>) The input array, its stringified keys destringified.


Top ↑

Source

File: src/Tribe/Utils/Array.php

		public static function destringify_keys( array $input, $prefix = 'sk_' ) {
			$visitor = static function ( $key, $value ) use ( $prefix ) {
				$destringified_key = 0 === self::strpos( $key, $prefix ) ? null : $key;

				return [ $destringified_key, $value ];
			};

			return static::array_visit_recursive( $input, $visitor );
		}

Top ↑

Changelog

Changelog
Version Description
4.12.14 Introduced.