note 73434 deleted from ref.array by felipe

From: Date: Sun, 30 Dec 2007 19:28:13 +0000
Subject: note 73434 deleted from ref.array by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134522@lists.php.net to get a copy of this message
Note Submitter: admin \x40 uostas.net ---- simple function to remove element from array saving index sequence <?php function array_remval($val,&$arr){ $i=array_search($val,$arr); if($i===false)return false; $arr=array_merge(array_slice($arr, 0,$i), array_slice($arr, $i+1)); return true; } ?> example: <?php $input=Array('a','b','c','d','e'); array_remval('d',$input); //result: //Array('a','b','c','e'); ?>

« previous php.notes (#134522) next »