Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_parse_args [ WordPress Function ]

wp_parse_args ( $args, $defaults = '' )
Parameters:
  • (string|array) $args Value to merge with $defaults
  • (array) $defaults Array that serves as the defaults.
Returns:
  • (array) Merged user defined values with defaults.
Defined at:



Merge user defined arguments into defaults array.

This function is used throughout WordPress to allow for both string or array to be merged into another array.

Source


<?php
function wp_parse_args$args$defaults '' ) {
    if ( 
is_object$args ) )
        
$r get_object_vars$args );
    elseif ( 
is_array$args ) )
        
$r =& $args;
    else
        
wp_parse_str$args$r );

    if ( 
is_array$defaults ) )
        return 
array_merge$defaults$r );
    return 
$r;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics