Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$org = "Apple £1200 iMac €1400 Desktop £1400 New (Description Text) (Description Text)";
preg_match('/^(.+?)\s+([$€£][^(]+?)\s+(\(.*\))/', $org, $match);
$brand = $match[1];
$price_products = $match[2];
$all_descriptions = $match[3];
print_r($match);
preg_match_all('/([$€£]\d+)\s+([^$€£]+)/', $price_products, $matches, PREG_PATTERN_ORDER);
$prices = $matches[1];
$products = $matches[2];
print_r($matches);
foreach($prices as $i => $price) { echo $products[$i].$price."-";
};