0

Parse error: syntax error, unexpected '‬' (T_STRING).

While i used the line as the former lines.

$past=$row['date'];
$present= date("Y-m-d H:i:s");
$second= strtotime($present) - strtotime($past);
if($second<=60){echo "Just Now";}
elseif($second<=3600){echo round($second/60) ."min";}
elseif($second<=86400){echo round($second/3600) . "hour";}
elseif($second<=604800){echo round($second/86400) . "day";}
elseif($second<=2592000‬){echo round($second/604800) . "week";} //in this line
elseif($second<=31536000‬‬){echo round($second/2592000) . "month";}
else{echo $row['date'];}
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98

1 Answers1

0

There were some invisible unicode characters in your code. You can try to use below instead:

$past = $row['date'];
$present = date("Y-m-d H:i:s");
$second = strtotime($present) - strtotime($past);
if ($second <= 60) {
  echo "Just Now";
} elseif ($second <= 3600) {
  echo round($second / 60) . "min";
} elseif ($second <= 86400) {
  echo round($second / 3600) . "hour";
} elseif ($second <= 604800) {
  echo round($second / 86400) . "day";
} elseif ($second <= 2592000) {
  echo round($second / 604800) . "week";
} elseif ($second <= 31536000) {
  echo round($second / 2592000) . "month";
} else {
  echo $row['date'];
}

One was after 2592000 and two other where right after 31536000 just before the end parenthesis.

Top-Master
  • 7,611
  • 5
  • 39
  • 71