This notice is thrown when you are trying to perform a math operation on a numeric value and a non-numeric type (string, bool, object etc.).
The reason that this may be happening in your code could be that either $from
or $to
are not valid date strings: see https://www.php.net/manual/en/datetime.formats.date.php and https://www.php.net/manual/en/datetime.formats.time.php for correct formatting.
Another possible reason is that your $conHour
does not have a valid numeric value.
EDIT: based on your update it is the latter: $conhour = string(5) "01:00"
you are trying to multiply a string. First (depending on how you get that variable) convert it in to a numeric value (1
) and then you will be able to multiply it
var_dump($from);
,var_dump($to);
, andvar_dump($conHour);
show? One of those obviously contains an invalid value. – John Condeif( ((strtotime($from)) + ($conHour*60*60) ) == strtotime($to) ){}
– Devsi Odedra$conHour
is clearly not a number so you can't do math with it. That is why you get that error. – John Conde