note 114339 added to function.ksort

From: Date: Mon, 10 Feb 2014 17:43:11 +0000
Subject: note 114339 added to function.ksort
Groups: php.notes 
Request: Send a blank email to php-notes+get-198448@lists.php.net to get a copy of this message
@thegrandoverseer you could also use the build-in php array functions to get exactly what you want to have: <?php $seed_array = array('foo'=>'bar', 'someotherkey'=>'whatev', 'bar'=>'baz', 'baz'=>'foo', 'anotherkey'=>'anotherval'); $keys_array = array('baz', 'foo', 'bar'); $return_array = array_intersect_key($seed_array, array_flip($keys_array)) + array_diff_key($seed_array, array_flip($keys_array)); ?> ---- Server IP: 212.124.37.9 Probable Submitter: 217.9.102.3 ---- Manual Page -- http://php.net/manual/en/function.ksort.php Edit -- https://master.php.net/note/edit/114339 Del: integrated -- https://master.php.net/note/delete/114339/integrated Del: useless -- https://master.php.net/note/delete/114339/useless Del: bad code -- https://master.php.net/note/delete/114339/bad+code Del: spam -- https://master.php.net/note/delete/114339/spam Del: non-english -- https://master.php.net/note/delete/114339/non-english Del: in docs -- https://master.php.net/note/delete/114339/in+docs Del: other reasons-- https://master.php.net/note/delete/114339 Reject -- https://master.php.net/note/reject/114339 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198448) next »