I want to get 112 position [01] and use this position[01] to compare something ? Can i do that ? Sorry about stupid question. I'm just a new guy really want to known. Thank for any help.
<?
$sql "SELECT * FROM truck WHERE t_ID = '001'";
$arry = odbc_fetch_array($DataExec);
echo "MAX value position's".$arry;
?>
echo $arry. This 1 i want to show [ MAX value position's 01.]. Or someone have better way.
<?php
$arr_numeric= array('41', '112', '25','54');
$max_position = array_search(max($arr_numeric), $arr_numeric);
echo $max_position;
?>
position start from 0.
OUTPUT
1
I get it with a google search.
$maxs = array_keys($array, max($array))
Note: this way you can retrieve every key related to a given max value.
If you are interested only in one key among all simply use $maxs[0]
$arr = array('41', '112', '25','54');
$index = array_search(max($arr),$arr);
echo "MAX value position's".$index;