1zeus1 Posted July 28, 2015 Share Posted July 28, 2015 How can I delete duplicate in $data? $data = array(); foreach ($get->find('h3[class=r] a') as $e) { //---// $data[] = "$var1,$var2"; } $file = "/var/www/html/top; $Handle = fopen($file, 'a') or die("Unable to open file!"); fwrite($Handle, implode("\n", $data)); fclose($Handle); I tried this, but it does not work $data = array(); foreach ($get->find('h3[class=r] a') as $e) { //---// $data[] = array_unique($var1,$var2); } $file = "/var/www/html/top; $Handle = fopen($file, 'a') or die("Unable to open file!"); fwrite($Handle, implode("\n", $data)); fclose($Handle); Regards. Quote Link to comment Share on other sites More sharing options...
Barand Posted July 28, 2015 Share Posted July 28, 2015 It's time to rtfm http://uk1.php.net/manual/en/function.array-unique.php 1 Quote Link to comment Share on other sites More sharing options...
1zeus1 Posted July 28, 2015 Author Share Posted July 28, 2015 I can not, to make this code Someone can help me Regards Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted July 28, 2015 Share Posted July 28, 2015 You pass your array $data to array_unique not the values you are adding to the array. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.