homepage Welcome to WebmasterWorld Guest from 54.198.148.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Verify if a key has a value in subarray
hanyaz




msg:4507449
 2:46 pm on Oct 12, 2012 (gmt 0)

Hello

I have the following array and i would like to make a function where i can check if one of the [tid] values is equal to 2 or not. How can do that in such multidimensional array ?
Array
(
[0] => Array
(
[tid] => 2
[taxonomy_term] => stdClass Object
(
[tid] => 2
[vid] => 2
[name] => languedoc
[description] =>
[format] =>
[weight] => 0
[vocabulary_machine_name] => mots_cles
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => skos:Concept
)

[name] => Array
(
[predicates] => Array
(
[0] => rdfs:label
[1] => skos:prefLabel
)

)

[description] => Array
(
[predicates] => Array
(
[0] => skos:definition
)

)

[vid] => Array
(
[predicates] => Array
(
[0] => skos:inScheme
)

[type] => rel
)

[parent] => Array
(
[predicates] => Array
(
[0] => skos:broader
)

[type] => rel
)

)

)

)

[1] => Array
(
[tid] => 3
[taxonomy_term] => stdClass Object
(
[tid] => 3
[vid] => 2
[name] => marseille
[description] =>
[format] =>
[weight] => 0
[vocabulary_machine_name] => mots_cles
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => skos:Concept
)

[name] => Array
(
[predicates] => Array
(
[0] => rdfs:label
[1] => skos:prefLabel
)

)

[description] => Array
(
[predicates] => Array
(
[0] => skos:definition
)

)

[vid] => Array
(
[predicates] => Array
(
[0] => skos:inScheme
)

[type] => rel
)

[parent] => Array
(
[predicates] => Array
(
[0] => skos:broader
)

[type] => rel
)

)

)

)

)

 

coopster




msg:4507998
 7:31 pm on Oct 14, 2012 (gmt 0)

array_walk might fit the bill:
[php.net...]

Austin80ss




msg:4508850
 11:47 am on Oct 17, 2012 (gmt 0)

If you are trying to grab data from inner arrays, try to use basic approach - recursion (function calls itself).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved