если вы хотите вернуть все значения $ shift_start_time при вызове функции, вам необходимо сохранить эти значения и вернуть их в конце функции.
Примерно так:
function Getshift($connect,$shiftid)
{
$query = "SELECT * FROM `shift` WHERE `shift_Id` = $shiftid ";
$statement = $connect->prepare($query);
$shift_start_times = array();
if($statement->execute())
{
$result = $statement->fetchAll();
foreach($result as $row)
{
$shift_Id_tbl = $row['shift_Id'];
$shift_start_time = date_format( date_create($row['start_time']), 'H:i:s' );
$shift_start_times[] = $shift_start_time;
$shift_start_time_new = date("H:i:s", strtotime('+15 minutes', strtotime($shift_start_time)));
$shift_start_time_new02 = date("H:i:s", strtotime('+15 minutes', strtotime($shift_start_time_new)));
$shift_end_time = date_format( date_create($row['end_time']), 'H:i:s' );
$earliest_arrival_time = date_format( date_create($row['earliest_arrival_time']), 'H:i:s' );
$lastest_arrival_time = date_format( date_create($row['lastest_arrival_time']), 'H:i:s' );
$minimum_time_gap = date_format( date_create($row['minimum_time_gap']), 'H:i:s' );
}
}
return $shift_start_times;
}
Когда вы вызываете свою функцию, вы можете просто зациклить эти значения, чтобы показать их:
$shift_start_times = Getshift($connect,$shiftid);
foreach($shift_start_times as $shift_start_time) {
echo $shift_start_time;
}