![]() PS: I'm answering this 'stale' question, because I think all the loops given as previous answers are overkill. For example, a series of totals in the working storage with the. ![]() 'dontSortMe' => 'this value doesnt need to be sorted') An array is used to store similar items or elements. $properOrderedArray = array_replace(array_flip(array('name', 'dob', 'address')), $customer) $properOrderedArray = array_merge(array_flip(array('name', 'dob', 'address')), $customer) $customer = 'this value doesnt need to be sorted' Selection statements, looping, arrays, strings, function sorting and. array_merge works by starting with the array you give it (in the proper order) and overwriting/adding the keys with data from your actual array: $customer = '123 fake st' To make clarity on the topic diagrams, examples, algorithms and programs are given. As has been mentioned previously, working with the compound key increases the amount of work needed. Sort an Array by keys based on another Array? This will still require 'sorting' and 'searching' on a multiple field 'key'.
0 Comments
Leave a Reply. |