_wp_array_set


_wp_array_set ( $array, $path, $value = null )

Access:
  • private
Parameters:
  • (array) array An array that we want to mutate to include a specific value in a path.
  • (array) path An array of keys describing the path that we want to mutate.
  • (mixed) value The value that will be set.
Defined at:

Description

Sets an array in depth based on a path of keys.It is the PHP equivalent of JavaScript's `lodash.set()` and mirroring it may help other components retain some symmetry between client and server implementations. Example usage: $array = array(); _wp_array_set( $array, array( 'a', 'b', 'c', 1 ) ); $array becomes: array( 'a' => array( 'b' => array( 'c' => 1, ), ), );

Related Functions

_wp_array_get, wp_array_slice_assoc, wp_parse_str, wp_cache_set, wp_parse_list

Top Google Results

User discussions

wpseek mobile