Skip to content

배열 정렬

MintState November 3, 2008 at 11:31 AM Views 12507

배열 정렬

<?php
 
$s = explode("|","4|5|7|1|2");

$m = array(
	"0" => "a",
	"1" => "b",
	"2" => "c",
	"3" => "d",
	"4" => "e",
	"5" => "f",
	"6" => "g"
);


for ($i=0; $i < count($s); $i++) {
 	$p[$m[$i]] = $s[$i]; 
}

asort($p);

print_r($p);
echo "<BR />";
while (list($key,$val) = each($p)) { 
	echo $key;
}

?>
Share X Facebook LINE QR code

0 comments

Be the first to comment.