Hi,
I'm having issue with understanding how this array works in OOP
. I want to sort this from ABC
or by 123
. I'm reading about it but I don't know how to run this code. I created the array but making it work is something new to me.
//This is my Array
$cheesecake = array(1 => 'Apple CheeseCake', 2 => 'Blueberry CheeseCake', 3 => 'Strawberry CheeseCake', 4 => 'Mango CheeseCake', 5 => 'Raspberry CheeseCake');
//This is my Function that sort the array
function sortObjectByKey($object,$cheesecake =''){
$temp = array();
foreach($object as $key => $valve){
$temp[$key] = '';
}
if($cheesecake == 'ASC'){
sortC($temp);
} else {
sortCa($temp);
}
$tempObject = new stdClass();
foreach($temp as $key => $valve){
$tempObject ->$key = $object-> $key;
}
return $tempObject;
}
Any Suggestions and explanation will help. I appreciate it. Thanks!