note 91319 deleted from function.array-pop by danbrown

From: Date: Fri, 05 Jun 2009 16:20:35 +0000
Subject: note 91319 deleted from function.array-pop by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156397@lists.php.net to get a copy of this message
Note Submitter: daniel.muhlrad at uvcms dot com ---- Two nice functions. 1) Remove a row in array giving the value. The result will have a sequential key. <?php function array_remove_by_value($arr,$value) { return array_values(array_diff($arr,array($value))); } ?> 2) Remove a row in array giving the key. The result will have a sequential key. <?php function array_remove_by_key($arr,$key) { return array_values(array_diff_key($arr,array($key))); } ?>

« previous php.notes (#156397) next »