[PHP] 배열에서 제일 큰 값을 가진 value 에 key 값 가져오기 - max, array_keys
우선, first 부터 nth 까지 문자열로 된 key 값에 각각 숫자로 된 value를 가진 배열이 있다. 이때 배열에서 제일 큰 값을 가지고 있는 value 의 key 값을 가지고 오고싶을 땐 다음과 같이 사용하면 된다. $array = array( 0 => 'first', 2 => 'second', /* ... */ 99 => 'nth' ); $max_key = max( array_keys( $array ) ); // 결과 : 99 1. 배열에서 제일 큰 값을 가져오는 건 max 함수를 쓴다. mixed max ( array $values ) 2. 그리고 그 value 에 key 값을 가져올 때는 array_keys 함수를 쓴다 array array_keys ( array $input [, mixe..