What are the best practices for storing and displaying key-value pairs from a string in PHP?

When storing and displaying key-value pairs from a string in PHP, one of the best practices is to use the `parse_str` function to parse the string into an associative array. This function can handle URL query strings and convert them into key-value pairs. Once the string is parsed, you can easily access and display the values using array keys.

// Example string containing key-value pairs
$string = "name=John&age=30&city=New York";

// Parse the string into an associative array
parse_str($string, $array);

// Display the values using array keys
echo "Name: " . $array['name'] . "<br>";
echo "Age: " . $array['age'] . "<br>";
echo "City: " . $array['city'];