i have this code that enters the values of an array into my db
foreach ($results->CategoryArray->Category as $key => $value) {
$categories_ids = (int) $value->CategoryID;
$CategoryName=$value->CategoryName;
if(strcmp($first_name,$CategoryName) <0)$firstID=(int) $value->CategoryID;
/// other codes to enter in db
}
echo $firstID
i want to get the value of $categories_ids when the $CategoryName is alphabetically first. but it don't work. i always get the last value of the last one in the array.