/**
  * @param PayPeriod $payperiod The payperiod that relates to the hours that the tutor worked
  * @param array $hoursArray holds the strings that represent all the hours worked by the tutor over the payperiod
  * @return array An array of instances of the SingleDay class which represents the hours worked over the payperiod
  */
 private function setPayPeriodSchedule(PayPeriod $payperiod, array $hoursArray)
 {
     if ($payperiod->getLengthOfPayPeriod() != count($hoursArray)) {
         echo count($hoursArray);
         echo $payperiod->getLengthOfPayPeriod();
         // Something bad because they both do not have the same number of entries
         echo "Internal error: The pay period and number of entries in the hours array were not equal in length.";
         die;
     }
     $finalArray = array();
     $lengthOfArrays = $payperiod->getLengthOfPayPeriod();
     $payperiodDates = $payperiod->getDatesInPayPeriod();
     for ($i = 0; $i < $lengthOfArrays; $i++) {
         $singleDay = new SingleDay($payperiodDates[$i], $hoursArray[$i]);
         $finalArray[] = $singleDay;
     }
     return $finalArray;
 }
<?php

require_once __DIR__ . '/../oop/PayPeriod.php';
date_default_timezone_set("America/New_York");
$startDate = $_POST['startDate'];
$payperiod = new PayPeriod(strtotime($startDate));
$payperiod->setToNextPayPeriod();
$datesInPeriod = $payperiod->getDatesInPayPeriod();
$formattedDates = array();
foreach ($datesInPeriod as $date) {
    $formattedDates[] = date("l n/j/y", $date);
}
echo json_encode($formattedDates);