TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-29-2008, 05:06 PM   #1 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Confused Array Match String

Hi all,

I was wondering why this doesn't work?

Code:
<?php
$todayis = date('F jS Y');

$hday = array("October 28th 2008", "November 11th 2008", "November 27th 2008", "December 25th 2008", "January 1st 2009", "January 19th 2009", "February 16th 2009", "May 25th 2009", "July 3rd 2009", "September 7th 2009", "October 12th 2009", "November 11th 2009", "November 26th 2009", "December 25th 2009");

if (in_array($todayis,$hday))
  {
  echo "Match found";
  }
else
  {
  echo "Match not found";
  }
?>
Can I not use a Variable($todayis), but have to use a string?
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Old 10-29-2008, 05:31 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

You can use a variable, that's not a problem at all. Remember that the date uses the timezone settings of the server (by default) and for many people it's the 29th (or 30th!) now so we'd expect "Match not found".
Salathe is offline  
Reply With Quote
Old 10-29-2008, 05:34 PM   #3 (permalink)
The Acquainted
 
buildakicker's Avatar
 
Join Date: Jan 2008
Posts: 119
Thanks: 21
buildakicker is on a distinguished road
Default

Thanks for clarifying that... I did have the wrong day in there, so how would it find it?! Got it.
__________________
SkiLeases.com
buildakicker is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:07 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design