Changeset 50965 for trunk/src/wp-includes/functions.php
- Timestamp:
- 05/24/2021 12:24:14 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r50958 r50965 4637 4637 * $array = array(); 4638 4638 * _wp_array_set( $array, array( 'a', 'b', 'c', 1 ); 4639 * 4639 4640 * $array becomes: 4640 4641 * array( … … 4646 4647 * ); 4647 4648 * 4648 * @param array $array An array that we want to mutate to include a specific value in a path. 4649 * @param array $path An array of keys describing the path that we want to mutate. 4650 * @param mixed $value The value that will be set. 4649 * @internal 4650 * 4651 * @since 5.8.0 4652 * @access private 4653 * 4654 * @param array $array An array that we want to mutate to include a specific value in a path. 4655 * @param array $path An array of keys describing the path that we want to mutate. 4656 * @param mixed $value The value that will be set. 4651 4657 */ 4652 4658 function _wp_array_set( &$array, $path, $value = null ) { … … 4660 4666 return; 4661 4667 } 4668 4662 4669 $path_length = count( $path ); 4670 4663 4671 if ( 0 === $path_length ) { 4664 4672 return; 4665 4673 } 4674 4666 4675 foreach ( $path as $path_element ) { 4667 4676 if ( … … 4683 4692 $array = &$array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration 4684 4693 } 4694 4685 4695 $array[ $path[ $i ] ] = $value; 4686 4696 }
Note: See TracChangeset
for help on using the changeset viewer.