|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-08-16 09:52 UTC] andrei@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 23:00:02 2025 UTC |
<?php $dict = array( "alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "yankee", "zulu" ); srand((double)microtime() * 1000000); $p = generate_str_array(100); $q = range(0, 99); shuffle($p); shuffle($q); array_multisort($p, SORT_DESC, SORT_STRING, $q, SORT_ASC, SORT_NUMERIC); // !!!!! the second arrays is not sorted print_array($p); print_array($q); function print_array(&$arr) { foreach ($arr as $i => $j) print("$i: $j\n"); } function generate_str_array($elements) { global $dict; for ($i = 0; $i < $elements; $i++) $arr[$i] = $dict[$i % sizeof($dict)]; return $arr; } ?>