Jump to content

Array check


k0z

Recommended Posts

If I have an array of data, like:

 

$times = array(1, 2, 3, 5, 6, 7);

 

How can I determine that the number 4 is missing?

 

The $times array will only ever hold data numbering from 1 to 7. These numbers represent the day of the week (1 is Monday, 7 is Sunday).

So, for example, $times might be:

$times = array(2, 6);

 

In the above case, I would need to determine that the numbers 1, 3, 4, 5, and 7 were missing.

Ideally, the missing numbers would be entered into another array.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/202327-array-check/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.