Advertisement
webpagefxjared

question...

Sep 14th, 2011
2,624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pike 0.54 KB | None | 0 0
  1. <?php
  2.  
  3. //which of this is faster...
  4.  
  5. // sort as you go
  6.  $children = array();
  7.   // its been requested that thes go in alphabetical order
  8.   foreach($tree['children'] as $id => $family){
  9.     $family['id'] = $id;
  10.     $children[$family['name']] = $family;
  11.     ksort($children);
  12.   }
  13.  
  14.  
  15. // OR
  16.  
  17. // sort at the end
  18.  
  19.  $children = array();
  20.   // its been requested that thes go in alphabetical order
  21.   foreach($tree['children'] as $id => $family){
  22.     $family['id'] = $id;
  23.     $children[$family['name']] = $family;
  24.   }
  25.   ksort($children)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement