Jump to content

Array help


amg182

Recommended Posts

Hi.

 

I have an multidemesional array that looks like this:

 


$numbers=array("1"=>'under 5',"2"=>'under 5',"3"=>'under 5',"4"=>'under 5');

 

Is it possible to write the array like this?(without using loops)

 

$numbers=array("1-4"=>'under 5');

or even:

$numbers=array("1,2,3,4"=>'under 5');

 

Thanks in advance.

 

Link to comment
Share on other sites

I am trying to echo out a particular comment depending on what is entered witihn a form(text input).

 

So if someone enters a value between 1-1000 it would echo out "Under 1000".

The problem i have is that i users can enter a value between 0 - 100,000.

Ideally i would like the text echo out to the nearest thousand so if someone entered 5400 it would echo out "under 6000".

 

Any ideas?

 

Thanks again.

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.