3v4l.org

run code in 300+ PHP versions simultaneously
<?php $title = "1 Gal. Black PE Grow Bag (100 per pack)"; $quantityarr = ["10", "100"]; foreach($quantityarr as $quantity){ if (strpos($title, $quantity . " ") !== false) { }else{ $title = preg_replace('/\([\s\S]+?\)/', '', $title); } echo $quantity . ": " . $title. "\n"; $title = "1 Gal. Black PE Grow Bag (100 per pack)"; }

preferences:
24.15 ms | 405 KiB | 5 Q