note 74471 modified in function.array-unique by james

From: Date: Fri, 19 Oct 2007 02:11:25 +0000
Subject: note 74471 modified in function.array-unique by james
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-131526@lists.php.net to get a copy of this message
An updated version of webcreators script that fixes a notice error about an undefined index and removes blank array value. <?php function my_array_unique($from) { for ($i=count($from)-1;$i>1;$i--) { $last = $from[$i]; $from[$i] = false; if (!in_array($last,$from)) { $from[$i]=$last; } } $from = array_unique($from); $from = array_slice($from,0,count($from)-1); return $from; } ?> --was-- An updated version of webcreators script that fixes a notice error about an undefined index and removes blank array value. function my_array_unique($from) { for ($i=count($from)-1;$i>1;$i--) { $last = $from[$i]; $from[$i] = false; if (!in_array($last,$from)) { $from[$i]=$last; } } $from = array_unique($from); $from = array_slice($from,0,count($from)-1); return $from; } http://php.net/manual/en/function.array-unique.php

« previous php.notes (#131526) next »