php - Day count - calculation and remove the minus


From the calculation returns -30. How can I remove the minus, so it just returns 30

$days = (strtotime(date("Y-m-d")) - strtotime($info['expiredate'])) / (60 * 60 * 24)

echo $days 

What is the best approach?




So long as you are sure the calculation is always in the right order, you can just use theabs() function to always display the positive number.




In mathematicsx-y == -(y-x)... Flip the order of subtraction.

People are also looking for solutions to the problem: html - How to mediate a SWF-Flashfile using a PHP mediating a.k.a. HTTP-Pseudostreaming script?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.