Jump to content

Basic String Containing Script for Numbers


tuoinside

Recommended Posts

Hello all! I am looking for a quick script that will examine a string of numbers, and output consecutive numbers that are not present in a given range.

 

IE.   string = 1, 3, 4, 5, 9, 10, 12

Returns = 2, 6, 7, 8, 11, 14 for range 1-14 etc.

 

Could this be done with a match or strpos function? Any help would be greatly appreciated!!! Thanks in advance,

 

Link to comment
Share on other sites

is this a homework? :P

 

// create an array of range (1-14)

// turn your present numbers into an array

// loop each number in the range

// check if the current number is not in the array

// echo it or save whatever

I don't do homework.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.