_wp_translate_php_url_constant_to_key

Translate a PHP_URL_* constant to the named array keys PHP uses.

Description

(string|bool) _wp_translate_php_url_constant_to_key( (int) $constant ); 

Returns (string|bool)

The named key or false.

Parameters (1)

0. $constant (int)
PHP_URL_* constant.

Usage

  1. if ( !function_exists( '_wp_translate_php_url_constant_to_key' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4. // PHP_URL_* constant. 
  5. $constant = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _wp_translate_php_url_constant_to_key($constant); 
  9.  

Defined (1)

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

/wp-includes/http.php  
  1. function _wp_translate_php_url_constant_to_key( $constant ) { 
  2. $translation = array( 
  3. PHP_URL_SCHEME => 'scheme',  
  4. PHP_URL_HOST => 'host',  
  5. PHP_URL_PORT => 'port',  
  6. PHP_URL_USER => 'user',  
  7. PHP_URL_PASS => 'pass',  
  8. PHP_URL_PATH => 'path',  
  9. PHP_URL_QUERY => 'query',  
  10. PHP_URL_FRAGMENT => 'fragment',  
  11. ); 
  12.  
  13. if ( isset( $translation[ $constant ] ) ) { 
  14. return $translation[ $constant ]; 
  15. } else { 
  16. return false;