PHP arsort()

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:57 판 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP arsort()
  • 배열을 값 역순으로 정렬하되 key는 유지하는 PHP 정렬함수
$fruits = ["d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"];
asort($fruits);
print_r($fruits);
# Array
# (
#     [a] => orange
#     [d] => lemon
#     [b] => banana
#     [c] => apple
# )
$fruits = ["lemon","orange","banana","apple"];
asort($fruits);
print_r($fruits);
# Array
# (
#     [1] => orange
#     [0] => lemon
#     [2] => banana
#     [3] => apple
# )

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}