wp_parse_str

Parses a string into variables to be stored in an array.

Description

wp_parse_str( (string) $string, (array) &$array ); 

Uses and stripslashes if is on.

Parameters (2)

0. $string (string)
The string to be parsed.
1. $array (array) => &$array
Variables will be stored in this array.

Usage

  1. if ( !function_exists( 'wp_parse_str' ) ) { 
  2. require_once ABSPATH . WPINC . '/formatting.php'; 
  3.  
  4. // The string to be parsed. 
  5. $string = ''; 
  6.  
  7. // Variables will be stored in this array. 
  8. $array = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wp_parse_str($string, $array); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/formatting.php  
  1. function wp_parse_str( $string, &$array ) { 
  2. parse_str( $string, $array ); 
  3. if ( get_magic_quotes_gpc() ) 
  4. $array = stripslashes_deep( $array ); 
  5. /** 
  6. * Filters the array of variables derived from a parsed string. 
  7. * @since 2.3.0 
  8. * @param array $array The array populated with variables. 
  9. */ 
  10. $array = apply_filters( 'wp_parse_str', $array );