- parse_ini_string
- Parameters
- Return Values
- Notes
- Related Functions
- mb_parse_str
- Parameters
- Return Values
- Changelog
- Related Functions
- Function mb_parse_str:
- Multibyte String Functions
- Most used PHP functions
- mb_parse_str
- Parameters
- Return Values
- Changelog
- Related Functions
- Function mb_parse_str:
- Multibyte String Functions
- Most used PHP functions
- parse_url
- Parameters
- Return Values
- Notes
- Changelog
- Related Functions
parse_ini_string
parse_ini_string returns the settings in string ini_string in an associative array.
The structure of the ini string is the same as the php.ini ‘s.
Parameters
The contents of the ini file being parsed.
By setting the process_sections parameter to true , you get a multidimensional array, with the section names and settings included. The default for process_sections is false
Can either be INI_SCANNER_NORMAL (default) or INI_SCANNER_RAW . If INI_SCANNER_RAW is supplied, then option values will not be parsed.
As of PHP 5.6.1 can also be specified as INI_SCANNER_TYPED . In this mode boolean, null and integer types are preserved when possible. String values «true», «on» and «yes» are converted to true . «false», «off», «no» and «none» are considered false . «null» is converted to null in typed mode. Also, all numeric strings are converted to integer type if it is possible.
Return Values
The settings are returned as an associative array on success, and false on failure.
Notes
Note:
There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, false, on, off, none. Values null, off, no and false result in «», and values on, yes and true result in «1», unless INI_SCANNER_TYPED mode is used. Characters ?<>|&~![()^» must not be used anywhere in the key and have a special meaning in the value.
Related Functions
mb_parse_str
Parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only be used for GET data for now. It parses URL encoded data, detects encoding, converts coding to internal encoding and set values to the result array or global variables.
Parameters
An array containing decoded and character encoded converted values.
Return Values
Returns true on success or false on failure.
Changelog
Version | Description |
8.0.0 | The second parameter was no longer optional. |
7.2.0 | Calling mb_parse_str without the second parameter was deprecated. |
Related Functions
Function mb_parse_str:
Multibyte String Functions
- mb_check_encoding
- mb_chr
- mb_convert_case
- mb_convert_encoding
- mb_convert_kana
- mb_convert_variables
- mb_decode_mimeheader
- mb_decode_numericentity
- mb_detect_encoding
- mb_detect_order
- mb_encode_mimeheader
- mb_encode_numericentity
- mb_encoding_aliases
- mb_eregi_replace
- mb_eregi
- mb_ereg_match
- mb_ereg_replace_callback
- mb_ereg_replace
- mb_ereg_search_getpos
- mb_ereg_search_getregs
- mb_ereg_search_init
- mb_ereg_search_pos
- mb_ereg_search_regs
- mb_ereg_search_setpos
- mb_ereg_search
- mb_ereg
- mb_get_info
- mb_http_input
- mb_http_output
- mb_internal_encoding
- mb_language
- mb_list_encodings
- mb_ord
- mb_output_handler
- mb_parse_str
- mb_preferred_mime_name
- mb_regex_encoding
- mb_regex_set_options
- mb_scrub
- mb_send_mail
- mb_split
- mb_strcut
- mb_strimwidth
- mb_stripos
- mb_stristr
- mb_strlen
- mb_strpos
- mb_strrchr
- mb_strrichr
- mb_strripos
- mb_strrpos
- mb_str_split
- mb_strstr
- mb_strtolower
- mb_strtoupper
- mb_strwidth
- mb_substitute_character
- mb_substr_count
- mb_substr
Most used PHP functions
- sandbox (118450116)
- preg_replace (206927)
- json_encode (145842)
- preg_match (135107)
- unserialize (115852)
- serialize (111478)
- hex2bin (101061)
- uniqid (82346)
- array (72506)
- json_decode (61808)
- iconv (54031)
- utf8_decode (47318)
- preg_replace_callback (47044)
- preg_match_all (45973)
- str_replace (42811)
- strtotime (38846)
mb_parse_str
Parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only be used for GET data for now. It parses URL encoded data, detects encoding, converts coding to internal encoding and set values to the result array or global variables.
Parameters
An array containing decoded and character encoded converted values.
Return Values
Returns true on success or false on failure.
Changelog
Version | Description |
8.0.0 | The second parameter was no longer optional. |
7.2.0 | Calling mb_parse_str without the second parameter was deprecated. |
Related Functions
Function mb_parse_str:
Multibyte String Functions
- mb_check_encoding
- mb_chr
- mb_convert_case
- mb_convert_encoding
- mb_convert_kana
- mb_convert_variables
- mb_decode_mimeheader
- mb_decode_numericentity
- mb_detect_encoding
- mb_detect_order
- mb_encode_mimeheader
- mb_encode_numericentity
- mb_encoding_aliases
- mb_eregi_replace
- mb_eregi
- mb_ereg_match
- mb_ereg_replace_callback
- mb_ereg_replace
- mb_ereg_search_getpos
- mb_ereg_search_getregs
- mb_ereg_search_init
- mb_ereg_search_pos
- mb_ereg_search_regs
- mb_ereg_search_setpos
- mb_ereg_search
- mb_ereg
- mb_get_info
- mb_http_input
- mb_http_output
- mb_internal_encoding
- mb_language
- mb_list_encodings
- mb_ord
- mb_output_handler
- mb_parse_str
- mb_preferred_mime_name
- mb_regex_encoding
- mb_regex_set_options
- mb_scrub
- mb_send_mail
- mb_split
- mb_strcut
- mb_strimwidth
- mb_stripos
- mb_stristr
- mb_strlen
- mb_strpos
- mb_strrchr
- mb_strrichr
- mb_strripos
- mb_strrpos
- mb_str_split
- mb_strstr
- mb_strtolower
- mb_strtoupper
- mb_strwidth
- mb_substitute_character
- mb_substr_count
- mb_substr
Most used PHP functions
- sandbox (118450116)
- preg_replace (206927)
- json_encode (145842)
- preg_match (135107)
- unserialize (115852)
- serialize (111478)
- hex2bin (101061)
- uniqid (82346)
- array (72506)
- json_decode (61808)
- iconv (54031)
- utf8_decode (47318)
- preg_replace_callback (47044)
- preg_match_all (45973)
- str_replace (42811)
- strtotime (38846)
parse_url
This function parses a URL and returns an associative array containing any of the various components of the URL that are present. The values of the array elements are not URL decoded.
This function is not meant to validate the given URL, it only breaks it up into the parts listed below. Partial and invalid URLs are also accepted, parse_url tries its best to parse them correctly.
Parameters
Specify one of PHP_URL_SCHEME , PHP_URL_HOST , PHP_URL_PORT , PHP_URL_USER , PHP_URL_PASS , PHP_URL_PATH , PHP_URL_QUERY or PHP_URL_FRAGMENT to retrieve just a specific URL component as a string (except when PHP_URL_PORT is given, in which case the return value will be an int ).
Return Values
On seriously malformed URLs, parse_url may return false .
If the component parameter is omitted, an associative array is returned. At least one element will be present within the array. Potential keys within this array are:
query — after the question mark ?
fragment — after the hashmark #
If the component parameter is specified, parse_url returns a string (or an int , in the case of PHP_URL_PORT ) instead of an array . If the requested component doesn’t exist within the given URL, null will be returned. As of PHP 8.0.0, parse_url distinguishes absent and empty queries and fragments:
http://example.com/foo → query = null, fragment = null
http://example.com/foo? → query = «», fragment = null
http://example.com/foo# → query = null, fragment = «»
http://example.com/foo?# → query = «», fragment = «»
Previously all cases resulted in query and fragment being null .
Note that control characters (cf. ctype_cntrl) in the components are replaced with underscores (_).
Notes
Caution:
This function may not give correct results for relative or invalid URLs, and the results may not even match common behavior of HTTP clients. If URLs from untrusted input need to be parsed, extra validation is required, e.g. by using filter_var with the FILTER_VALIDATE_URL filter.
Note:
This function is intended specifically for the purpose of parsing URLs and not URIs. However, to comply with PHP’s backwards compatibility requirements it makes an exception for the file:// scheme where triple slashes (file:///. ) are allowed. For any other scheme this is invalid.
Changelog
Related Functions
- basename — Returns trailing name component of path
- dirname — Returns a parent directory’s path
- http_build_query — Generate URL-encoded query string
- parse_str — Parses the string into variables
- pathinfo — Returns information about a file path