note 102564 added to function.array-key-exists

From: Date: Tue, 22 Feb 2011 00:30:18 +0000
Subject: note 102564 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-177199@lists.php.net to get a copy of this message
@tech at signhere envy dot de There is a much more straight forward way of renaming an array, like this example: <?php function array_rename_key($array, $key, $newkey) { if( ! array_key_exists($key, $array) || array_key_exists($newkey, $array) ) return FALSE; $array[$newkey] = $array[$key]; unset($array[$key]); return $array; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 187.126.250.213 ---- Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php Edit -- https://master.php.net/note/edit/102564 Del: integrated -- https://master.php.net/note/delete/102564/integrated Del: useless -- https://master.php.net/note/delete/102564/useless Del: bad code -- https://master.php.net/note/delete/102564/bad+code Del: spam -- https://master.php.net/note/delete/102564/spam Del: non-english -- https://master.php.net/note/delete/102564/non-english Del: in docs -- https://master.php.net/note/delete/102564/in+docs Del: other reasons-- https://master.php.net/note/delete/102564 Reject -- https://master.php.net/note/reject/102564 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177199) next »