Jump to content

[SOLVED] calculation problem


graham23s

Recommended Posts

Hi GUys,

 

im working out a users age, by deducting the year they were born from this year 2007

 

so i'm born on 1979, todays year is 2007

 

2007 - 1979 leaves 28

 

but the code shows as -28 instead of just 28, i tried a str_replace but no joy

 

  ## Year calculation
  $profileyear = $yearborn - $thisyear;
  
  ## Get rid of the - sign
  str_replace("-"," ", $profileyear);

 

can anyone tell me what i did wrong?

 

thanks guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/76748-solved-calculation-problem/
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.