note 23906 deleted from function.array-flip by dams

From: Date: Wed, 31 Jul 2002 19:14:24 +0000
Subject: note 23906 deleted from function.array-flip by dams
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-34075@lists.php.net to get a copy of this message
Hi, here is a mean to delete duplicated entries in an array : $z = 0; $tab[$z++]="a"; $tab[$z++]="a"; $tab[$z++]="a"; $tab[$z++]="b"; $tab[$z++]="b"; $tab[$z++]="b"; $tab[$z++]="b"; $tab[$z++]="c"; $tab[$z++]="d"; $tab[$z++]="d"; $tab[$z++]="e"; $tab[$z++]="f"; $tab[$z++]="g"; $tab = array_flip(array_flip($tab)); print_r($tab); Array ( [2] => a [6] => b [7] => c [9] => d [10] => e [11] => f [12] => g ) then you can use foreach to get each value... I needed this because i use a function that generate block with different css sheet In order not to echo <LINK ...> two times with the same content, i find this easy programming (but not fast) way. Paquerette

« previous php.notes (#34075) next »