PHP parse_str Function

What is parse_str Function?

Explanation

This function parses the string into variables.

Syntax:


parse_str(string,array)

In the above syntax "string" specifies the text to be parsed, "array" is an optional parameter where one can specify the array to store the variables.

Example :


<?php
parse_str("id=1&company=HIOX%20INDIA",$arr);
print_r($arr);
?>
Result :

Array
{
[1] => 1
[company] => HIOX INDIA
}

In the above PHP example for parse_str function the string variables are displayed in an array with their values and keys.

PHP Topics


Ask Questions

Ask Question