Jump to content

Searching for a given value in an Array.


theITvideos

Recommended Posts

Hi there,

 

I'm working on PHP webform and I have a variable called $weightInfo which has the value 5000|6000

 

Now I have a list of Arrays and I would like to see if our variable value (i.e 5000|6000) is in that list of Array: Here is the ArrayList:

 

 

 $WeightArray = array('' => '',    '0|100' => '100g or Less',    '101|250' => '101g to 250g',     '251|500' => '251g to 500g',    '501|1000' => '501g to 1kg',    '1000|2000' => '1kg to 2kg',    '2000|3000' => '2kg to 3kg',    '3000|4000' => '3kg to 4kg',    '4000|5000' => '4kg to 5kg',    '5000|6000' => '5kg to 6kg',    '6000|7000' => '6kg to 7kg',    '7000|8000' => '7kg to 8kg',     '8000|9000' => '8kg to 9kg',      '9000|10000' => '9kg to 10kg',    'customValues' => 'Custom Values'    );

 

 

Now as we can see, in this ArrayList, there is that value 5000|6000.

 

How do we find this through code, do we need some kind of looping or how do we check it.

 

Kindly reply.

 

Thank you :)

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.