登录 | 注册 | FAQ
Anonymous

if else not working

+ 发表回复

3 篇帖子 分页: 1 / 1


if else not working

mr code » 周二 6月 10, 2014 10:52 am

<? php

$currMonth=date('F', time());
if ($currmonth == 'august'){
echo"It's August, so it's really hot.";
}
else
{
echo"Not August, so at least not in the peak of the heat.";
}
?>

nothing is being executed... just a blank screen
头像

mr code

  • 帖子: 5
  • 注册: 周一 2月 17, 2014 11:02 am

Re: if else not working

juliusijie » 周三 6月 11, 2014 2:36 pm

The date function returns 'August' not 'august' .
头像

juliusijie

  • 帖子: 19
  • 注册: 周六 2月 08, 2014 7:56 am
  • 地址: Lagos, Nigeria

Re: if else not working

XainPro » 周四 6月 12, 2014 11:35 am

It should be:

<?php
$month = date('F', time());
if ($month == 'August')
{
echo 'It\'s August, so it\'s really hot.';
}
else
{
echo 'Not August, so at least not in the peak of the heat.';
}
?>
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm


+ 发表回复

分页: 1 / 1