Tribe__Utils__Array::filter_to_flat_scalar_associative_array( array $array )
Discards everything other than array values having string keys and scalar values, ensuring a one-dimensional, associative array result.
Contents
Parameters
- $array
-
(array) (Required)
Return
(array) Associative or empty array.
Source
File: src/Tribe/Utils/Array.php
public static function filter_to_flat_scalar_associative_array( array $array ) { $result = []; if ( ! is_array( $array ) ) { return $result; } foreach ( $array as $k => $v ) { if ( ! is_string( $k ) ) { continue; } if ( ! is_scalar( $v ) ) { continue; } $result[ $k ] = $v; } return $result; }
Changelog
Version | Description |
---|---|
4.12.2 | Introduced. |