vendredi 27 mai 2016

The use of the wp_parse_args function using parenthesized "array"?

I've been trying (somewhat unsuccesfully) my hand at plugin development and in a tutorial I am going through, the author specifies the wp_parse_args function as follows:

$instance = wp_parse_args( (array) $instance, $defaults );

This is within an extended class of WP_Widget. I am just wondering about the use of the parenthesized "array" within the function? On the codex wordpress states that the function merges an array of default values and an array of arguments, but the syntax used in the codex does not include a parenthesized 'array'. What is the purpose of calling the function in this manner?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire