Skip to content

Instantly share code, notes, and snippets.

@yeco
Created March 11, 2010 17:14
Show Gist options
  • Select an option

  • Save yeco/329365 to your computer and use it in GitHub Desktop.

Select an option

Save yeco/329365 to your computer and use it in GitHub Desktop.
function limpiarArray($array){
        $retorno=null;
        if($array!=null){
            $retorno[0]=$array[0];
        }
        for($i=1;$i<count($array);$i++){
            $repetido=false;
            $elemento=$array[$i];
            for($j=0;$j<count($retorno) && !$repetido;$j++){
                if($elemento==$retorno[$j]){
                    $repetido=true;
                }
            }
            if(!$repetido){
                $retorno[]=$elemento;
            }
        }
        return $retorno;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment