Прочитать и заменить определённую запись при выводе базы данных в массиве

КАК заменить значения в объекте stdClass Object: Например было так:

stdClass Object ( [mylocate] => United Arab Emirates,Dubai [sendlocate] => USA,Washington [starttime] => 06/05/20 [endtime] => 12/31/20

Результат должен:

stdClass Object ( [mylocate] => USA,Washington [sendlocate] => USA,Washington [starttime] => 06/05/20 [endtime] => 12/31/20

              // We have results, create an array to hold the results
    // and an array to hold the data
    $resultArray = array();
    $tempArray = array();

    // Loop through each result
    while($row = $result->fetch_object())
    {
    // Add each result into the results array
    $tempArray = $row;
        array_push($resultArray, $tempArray);
    }

     // Encode the array to JSON and output the results
    echo json_encode($resultArray);

Ответы (0 шт):