How can PHP arrays be manipulated to store and organize extracted data from a text?

To store and organize extracted data from a text in PHP, you can create an array and use functions like explode() or preg_match_all() to extract the data and store it in the array. You can then manipulate the array using various array functions to organize the data as needed.

// Sample text data
$text = "Name: John Doe, Age: 30, Occupation: Developer";

// Extract data using regular expressions
preg_match_all('/(\w+): (\w+)/', $text, $matches);

// Store extracted data in an associative array
$data = array_combine($matches[1], $matches[2]);

// Display the organized data
print_r($data);