How to use parse str in PHP

In this article I will explain how the parse_str() function can be used in PHP.
  • 1834

parse_str() function in PHP

  • The parse_str() function is used to parses a query string into variables.
  • The parse_str() function is set the variables,If the array parameter is not set.

Syntax

parse_str(string,array)

Parameter

  • string string is required parameter. Determine the string to be parse.
  • array array is optional parameter. It is the name of an array to store the variables. This parameter indicates that the variables will be stored in an array.

Example

The following example show to how the parse_str() function can be used in PHP.

<html>

<body>

<h3 style="color: darkgreen;">parse_str() function example in PHP</h3>

    <?php

    parse_str("id=14 <br> &name=Nitin".'<br>',$myArray);

    print_r($myArray);

    ?>

</body>

</html>

 

Output

parse-str-php.gif
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.