Skip to content

Instantly share code, notes, and snippets.

@FDSoftware
Last active December 17, 2019 21:50
Show Gist options
  • Save FDSoftware/4cfdd0340189ceb9f62189db8caa8643 to your computer and use it in GitHub Desktop.
Save FDSoftware/4cfdd0340189ceb9f62189db8caa8643 to your computer and use it in GitHub Desktop.
Buscar repetidos en un array en php
<?php
$vars = array(
0 => 1234352,
1 => 1234351,
2 => 41,
3 => null,
4 => 1352,
5 => 0,
6 => 0,
);
$filtrados = array_filter($vars);
$unicos = array_unique ($filtrados);
if(sizeof($unicos) != sizeof($filtrados)){
echo 'hay repetidos';
}else {
echo'no hay repetidos';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment