473,379 Members | 1,317 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,379 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 1552
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.