Example 1 — Parse a Simple Query String
Pass a query string and a variable to receive the result.
<?php
parse_str("name=John&age=30", $data);
print_r($data);
echo $data["name"], PHP_EOL; How It Works
- Write the query string. Pairs are joined with &.
- Pass a variable. $data is filled by reference.
- Print the array. Each key matches a name before =.
- Read a value. $data["name"] is "John".

