What is the best way to convert a string into a multidimensional array in PHP?

When converting a string into a multidimensional array in PHP, you can use the `json_decode()` function to decode the JSON string into an array. This function will automatically convert the JSON string into a multidimensional array if the string is formatted correctly. Make sure the string is properly formatted as JSON before attempting to decode it.

$string = '{"key1": {"subkey1": "value1"}, "key2": {"subkey2": "value2"}}';
$multiArray = json_decode($string, true);

print_r($multiArray);