src/Date.php
public function add($interval, $value = 1, $overflow = null)
    {
        if (is_string($interval)) {
            // Check for ISO 8601
            if (strtoupper(substr($interval, 0, 1)) == 'P') {
                $interval = new DateInterval($interval);
            } else {
                $interval = DateInterval::createFromDateString($interval);
            }
        }

        $method = new ReflectionMethod(parent::class, 'add');
        $result = $method->getNumberOfRequiredParameters() === 1
            ? parent::add($interval)
            : parent::add($interval, $value, $overflow);

        return $result ? $this : false;
    }
public function add($interval, $value = 1, $overflow = null)
    {
        if (is_string($interval)) {
            // Check for ISO 8601
            if (strtoupper(substr($interval, 0, 1)) == 'P') {
                $interval = new DateInterval($interval);
            } else {
                $interval = DateInterval::createFromDateString($interval);
            }
        }

        $method = new ReflectionMethod(parent::class, 'add');
        $result = $method->getNumberOfRequiredParameters() === 1
            ? parent::add($interval)
            : parent::add($interval, $value, $overflow);

        return $result ? $this : false;
    }
public function add ( $ interval , $ value = 1 , $ overflow = null ) { if ( is_string ( $ interval ) ) { // Check for ISO 8601 if ( strtoupper ( substr ( $ interval , 0 , 1 ) ) == 'P' ) { $ interval = new DateInterval ( $ interval ) ; } else { $ interval = DateInterval :: createFromDateString ( $ interval ) ; } } $ method = new ReflectionMethod ( parent :: class , 'add' ) ; $ result = $ method -> getNumberOfRequiredParameters ( ) === 1 ? parent :: add ( $ interval ) : parent :: add ( $ interval , $ value , $ overflow ) ; return $ result ? $ this : false ; }
Adds an amount of days, months, years, hours, minutes and seconds to a Date object.

@param DateInterval|string $interval
@param int                 $value (only effective if using Carbon 2)
@param bool|null           $overflow (only effective if using Carbon 2)
@return Date|bool
Adds an amount of days months years hours minutes and seconds to a Date object .