array_replace_recursive( array $base = array(), array $replacements = array() )

PHP-agnostic version of {@link array_replace_recursive()}.


Description

The array_replace_recursive() function is a PHP 5.3 function. ClassicPress currently supports down to PHP 5.2, so this method is a workaround for PHP 5.2.

Note: array_replace_recursive() supports infinite arguments, but for our use- case, we only need to support two arguments.

Subject to removal once ClassicPress makes PHP 5.3.0 the minimum requirement.

See also


Parameters

$base

(array) (Optional) Array with keys needing to be replaced.

Default value: array()

$replacements

(array) (Optional) Array with the replaced keys.

Default value: array()


Return

(array)


Source

File: wp-includes/compat.php

	 * implementing the Countable interface.
	 *
	 * @since WP-4.9.6
	 *
	 * @param mixed $var The value to check.
	 *
	 * @return bool True if `$var` is countable, false otherwise.
	 */
	function is_countable( $var ) {
		return ( is_array( $var )
			|| $var instanceof Countable
			|| $var instanceof SimpleXMLElement
			|| $var instanceof ResourceBundle
		);
	}
}

if ( ! function_exists( 'is_iterable' ) ) {
	/**
	 * Polyfill for is_iterable() function added in PHP 7.1.
	 *
	 * Verify that the content of a variable is an array or an object
	 * implementing the Traversable interface.
	 *
	 * @since WP-4.9.6
	 *
	 * @param mixed $var The value to check.
	 *
	 * @return bool True if `$var` is iterable, false otherwise.

Changelog

Changelog
Version Description
WP-4.5.3 Introduced. WP-4.5.3