It seems that your problem is logic in the use of variables, since you try to add 2 string
, when you only concatenate them, that is, as the values of the variables are in quotes, then you concatenate them $vd+$suma;
.
As a result, you will throw "01"+"4" = "014"
. So, if you want to do mathematical operations with the variables you must put them without double quotes ""
:
Example:
$fecha = date('Y-m-d');
//sumas o restas dias, en este caso el estamos 8 dias teniendo en cuenta que hoy estamos a 9
$nuevafecha = strtotime ( '-8 day' , strtotime ( $fecha ) ) ;
//sumas o restas meses
// $nuevafecha = strtotime ( '+1 month' , strtotime ( $fecha ) ) ;
//sumas o restas años
// $nuevafecha = strtotime ( '+2 year' , strtotime ( $fecha ) ) ;
// deja la que necesites y aqui le das el nuevo valor
$nuevafecha = date ( 'Y-m-d' , $nuevafecha );
<div class="col-md-12 col-sm-12">
<div class="row">
<?php
//primero comparas que $quediaes sea diferente "Sun", luego en el otro parentesis que alguna de las dos fechas sean inferiores
if($quediaes!="Sun" && ("01-05-2018" >= $fecha || $fecha <= $nuevafecha)){
include('domingo.php');
}
?>
</div>
</div>
Note: Seeing that what you need is to operate with the dates, here I modify the answer in which you can play with the dates, and the conditional for the range of dates would be like this, so that the variable $fecha
is in that time range.