Jump to content

help in this code


seco

Recommended Posts

Hi

i found ths code and im asking if its right

this code check if the product is expired

it subtract the timestamp of today from the end date of the product and divide by 86400 and check if less than zero

- one more thing . why the @ sign needed?

 

(strtotime(date('Y-m-d')) - strtotime(@$row_rsProducts['enddate_prd']))/86400 <0

 

thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/99679-help-in-this-code/
Share on other sites

This code snippet subtracts the end date of the product from today's date. If that is less than zero then the product hasn't expired yet. The "@" suppresses error messages. I do not think the "/86400" is necessary here. I would write it as

<?php
$check_exp = time() -  strtotime($row_rsProducts['enddate_prd']);
if ($check_exp < 0)
   echo "Product has expired"
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/99679-help-in-this-code/#findComment-509944
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.