<?php $phones = "Samsung Galaxy S8~LG G6~iPhone 7 Plus~ Motorola Z2"; $value = preg_replace('/(\d+.*?)(~)/', '($1)$2', $phones . "~"); $value = "<li>". str_replace("~", ",</li>\n<li>", substr($value,0,-1)) . "</li>"; Echo $value;
You have javascript disabled. You will not be able to edit any code.