473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with arrays

What I'm trying to do is check if the dates in the array $holi[]
matches $evalday (not in an array)
but with limited success the data in the array is:

$holi[1] = 2006-06-20;
$holi[2] = 2006-06-28;
$holi[3] = 2006-07-19;
$holi[4] = 2008-06-24;
$holi[5] = 2006-06-30;

$evalday = date("Y-m-d", strtotime("+ 1 days");

if($evalday == $holi) {
echo("For the purpose of this excercise, $evalday is a holiday");
}

Thanks in advance.

Jun 28 '06 #1
3 1547
Try array_search() function:

if (array_search($evalday, $holly))
echo("For the purpose of this excercise, $evalday is a holiday");
--
http://blog.deshot.com
http://www.sederet.com

ib*************@gmail.com wrote:
What I'm trying to do is check if the dates in the array $holi[]
matches $evalday (not in an array)
but with limited success the data in the array is:

$holi[1] = 2006-06-20;
$holi[2] = 2006-06-28;
$holi[3] = 2006-07-19;
$holi[4] = 2008-06-24;
$holi[5] = 2006-06-30;

$evalday = date("Y-m-d", strtotime("+ 1 days");

if($evalday == $holi) {
echo("For the purpose of this excercise, $evalday is a holiday");
}

Thanks in advance.


Jun 28 '06 #2
Thank you, in_array($evalday, $holi) worked. I should have done this
database instead for my school project.

Jun 28 '06 #3
ib*************@gmail.com wrote:
What I'm trying to do is check if the dates in the array $holi[]
matches $evalday (not in an array)
but with limited success the data in the array is:

$holi[1] = 2006-06-20;
$holi[2] = 2006-06-28;
$holi[3] = 2006-07-19;
$holi[4] = 2008-06-24;
$holi[5] = 2006-06-30;

$evalday = date("Y-m-d", strtotime("+ 1 days");

if($evalday == $holi) {
echo("For the purpose of this excercise, $evalday is a holiday");
}

Thanks in advance.

You either have to test each element separately [foreach()
if($holiday = $evalday)...] or use the builtin function
inarray($evalday, $holi).
Jun 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Fnark! | last post by:
I am creating a shopping cart using PHP Version 4.1.2. I am creating and registering a cart object in a session. The cart object contains an array of arrays called $order whose elements are a...
2
by: Xarky | last post by:
Hi, I have a two dimensional array as follows: double myArray = new double; Now I have a method which is returning double, which is of size 41. I need to put the data of the array returned...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
1
by: codergem | last post by:
The following code is for heap sort but its not working properly. According to my analysis the Logic is correct but still its not showing the correct output. Thanks. #include "stdafx.h"...
4
by: sonjaa | last post by:
Hi last week I posted a problem with running out of memory when changing values in NumPy arrays. Since then I have tried many different approaches and work-arounds but to no avail. I was...
3
by: MariyaGel | last post by:
I have wrote the program and it worked fine until I had to include one more array into it. As you can see below the two arrays of volume and mass are working properly now I need to include a third...
9
by: weidongtom | last post by:
Hi, I've written the code that follows, and I use the function add_word(), it seems to work fine *before* increase_arrays() is called that uses realloc() to allocate more memory to words. But...
19
by: rmr531 | last post by:
First of all I am very new to c++ so please bear with me. I am trying to create a program that keeps an inventory of items. I am trying to use a struct to store a product name, purchase price,...
43
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.