I'm trying to remove duplicates lines from text file. My codes thus work though but its brings error which i have looked through the codes. Everything works. I used the inbuilt function like the array_unique but the array numbers start from 0 instead of 1. So i'm wondering if anyone could help me . Thanks
<?php
hott.txt(content)
vnea@yahoo.com
vnea@yahoo.com
dabrd@gmail.com
vnea@yahoo.com
dabrd@gmail.com
bread@gmail.com
bread@gmail.com
vnea@yahoo.com
dabrd@gmail.com
bread@gmail.com
syeas@hotmail.com
vnea@yahoo.com
vnea@yahoo.com
$contents=file("hott.txt");
$array = [];
foreach ($contents as $k=>$v){
$v = trim($v);
$array[$v]++;
}
print_r($array);
?>
```