Here my code:
public function getTime(){
$store = $this->getStoreId();
$mapping_time = $this->scopeConfig->getValue(self::XPATH_HOURMAX, ScopeInterface::SCOPE_STORE, $store);
$postTime = unserialize($mapping_time);
$time_array =array();
foreach ($postTime as $key => $value) {
$time_array[trim($value['field1'])] =
[
trim($value['field1']),
trim($value['field2'])
];
}
return $time_array;
}
Actual result :
output:
my expection is:
value option
9:30 AM - 2:30 AM : "9:30 AM - 2:30 AM "
6:30 AM - 9:30 AM : "6:30 AM - 9:30 AM "
3:30 AM - 9:30 AM : "3:30 AM - 9:30 AM "