Jump to content

help arrays!


Pupe

Recommended Posts

please answer  this question in php..

 

 

 

 

I need three arrays,One with shops, second with other instruments, and the third with the links between them. For example:
 
 
 
$instruments = array(array(1,"Guitar"),array(2,"Drums"));
$stores = array(array(5,"My Store"),array(10,"Your store"));
$connections = array(array(1,5),array(1,10),array(2,5));
 
Then, based on the variable defined in the program, for example:
$search="Guitar";
 
Then must do this,need to find a shop where the requested instrument. First, from the first series download id instrument (for example, the guitar has id 1).
Then, from the $ connections and find all the shops where there is (that are members of the 0 and 1, respectively, shop with IDs 5 and 10)
Finally, from the $ stores, download, store names (in this example are 5 and 10).

:sweat:

Link to comment
Share on other sites

can you resolve all code here..

You might have missed it. Let me quote it here for you so you don't need to scroll up:

[I]f you make an effort we might be able to help you. We won't do it for you.

Write something yourself. Try it. If it doesn't work then come back, post the code, and tell us how is it not working. Then we'll give you suggestions on how to change it. Rinse and repeat.

Link to comment
Share on other sites

Tip: Maping (array_map) $instruments and $connections and find out the commons indexes between them, then loop $connections through the second indexes and match them in $stores.

Edited by jazzman1
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.