Jump to content

Find key and value in array


axtg

Recommended Posts

Hi,

 

I'll keep it short this time :). I'm loading all database fields and values into an array ($row). Printing this shows e.g.

 

[0] => Array
        (
            [0] => 00001
            [page_id] => 00001
            [1] => home
            [urlpage] => home
            [3] => 1
            [toplevel] => 1
            [4] => 0
            [sublevel] => 0
        ) cont'd...

 

I also have an array with only the toplevel and sublevel values. Now I need to check whether the ones above exist in the one below.

 

[0] => Array
        (
            [sublevel] => 1
            [toplevel] => 1
        )

    [1] => Array
        (
            [sublevel] => 2
            [toplevel] => 1
        )

 

I tried the - to me - obvious functions in_array() and array_search(), but without luck. It's due to the key and value included I think. What function to use here? And how?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/196465-find-key-and-value-in-array/
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.