I get values from the textarea
as follows:
2342
de20343
23094
zz900
234432
zz900
2342
I want to find duplicates (eg: "zz900" and "2342") and delete them. In addition, blank lines must be removed.
Is there a single function that will do this?
Check this, this is new code:-
<?php
$string_old = "2342
de20343
_
_
23094
zz900
234432
zz900
2342";
$array_by_exploding_through_next_line = explode ("\n",$string_old);
$new_array = array();
foreach($array_by_exploding_through_next_line as $key => $value){
if(strpos($array_by_exploding_through_next_line[$key], '_') !== FALSE || strpos($array_by_exploding_through_next_line[$key], ' ') !== FALSE){
}else{
$new_array[] = $value;
}
}
$string_new = implode('',array_unique($array_by_exploding_through_next_line));
print_r($array_by_exploding_through_next_line);
echo "<br>";
echo $string_new;
die;
?>