Write a program to calculate the total cost of different types of furniture. You will be given some lines of input until you receive the line "Purchase".

For the line to be valid it should be in the following format:

">>{furniture name}<<{price}!{quantity}"

The price can be floating point number or whole number. Store the names of the furniture and the total price. At the end print the each bought furniture on separate line in the format:

"Bought furniture:

{1st name}

{2nd name}

"

And on the last line print the following:

"Total money spend: {spend money}" formatted to the second decimal point.

Examples: Here is my solution:

```<?php

\$pattern = '/>>([A-Za-z]+)<<([\d]+[\d.]{1,})!(\d+)/';
\$matches = [];
\$totalMoneySpent = 0;

echo "Bought furniture:" . PHP_EOL;

while (\$input !== "Purchase") {

if (preg_match(\$pattern, \$input, \$matches)) {
\$product = \$matches;
\$price = \$matches;
\$quantity = \$matches;
\$totalMoneySpent += \$price * \$quantity;
echo \$product . PHP_EOL;
}