[Solved] I want to remove duplicate entries separated by commas from text area when form is submitted? [closed]


Use $array = explode(",",$string) then array_unique($array); and then $string = implode(",",$array)

<?php
    $string =  "10,12,10,15,12";// Textarea value
    $array = explode(",",$string);// make string to array separated by comma `,` 
    $array = array_unique($array); // remove duplicate from array
    $string = implode(",",$array); // again make array to string with comma `,` separated
    echo $string;
?>

Live demo : https://eval.in/884529

2

solved I want to remove duplicate entries separated by commas from text area when form is submitted? [closed]