Arguments date in PHP

PHP

	if ( isset( $argv ) && isset($argv[1])) {
		$d = DateTime::createFromFormat("Y-m-d", $argv[1]);
		$date_errors = DateTime::getLastErrors();
		
		if ($date_errors['warning_count'] + $date_errors['error_count'] > 0) {
			die();
		}else{
			$obs_date = $argv[1];
		}
	}else{
		$obs_date = date('Y-m-d');
	}

CMD
php index.php 2019-09-10