If exist in array (php)

Posted by Glister on Stack Overflow See other posts from Stack Overflow or by Glister
Published on 2010-04-28T16:55:55Z Indexed on 2010/04/28 17:03 UTC
Read the original article Hit count: 189

Filed under:
|

There are two arrays, that are given for $link from foreach. One time $link must be a first arrow, and a third - the second. So:

1 array:

Array (

[width] => 800

[height] => 1142

[hwstring_small] => height='96' width='67' [file] => 2010/04/white-1051279.jpg

[sizes] => Array (
[thumbnail] => Array ( [file] => white-1051279-100x150.jpg [width] => 100 [height] => 150 )
[medium] => Array ( [file] => white-1051279-200x285.jpg [width] => 200 [height] => 285 )
)

[image_meta] => Array ( [aperture] => 0 [credit] => [camera] => [caption] => [created_timestamp] => 0

[copyright] => [focal_length] => 0 [iso] => 0 [shutter_speed] => 0 [title] => ) ) 

2 array:

Array (

[width] => 50 [height] => 50 [hwstring_small] => height='50' width='50' [file] => 2010/04/images1.jpeg

[image_meta] => Array ( [aperture] => 0 [credit] => [camera] => [caption] => [created_timestamp] => 0

[copyright] => [focal_length] => 0 [iso] => 0 [shutter_speed] => 0 [title] => )
)

The difference - first one has [sizes].

Searching for a way to detect, is there [sizes] in given array.

Tryed if (in_array("[sizes]", $link)) { } else { }, but it doesnt work.

Thanks.

© Stack Overflow or respective owner

Related posts about arrays

Related posts about php