Ask a Question related to PHP Development, Design and Development.
-
Mattias.Campe #1
Multidimensional array: see if 1st key is available
Hi,
I've got an multidimensional array
$ret = $country_code[$countryCode][$langCode];
Now I want to see if $countryCode is even in that array, because if it's
not, it doesn't make many sense to look further for $langCode.
Eg.
$country_code = array('BE' =>
array ('en' => 'Belgium',
'nl' => 'België'),
'NL' =>
array ('en' => 'Netherlands',
'nl' => 'Nederland'),
);
Searching for 'BE' would make sense, but 'LP' wouldn't.
I already tried:
$arr = array($country_code['LP']);
if (sizeof($arr) == 0)
print "LP not found!"
But that doesn't seem to work :-s. Would sb have any suggestions?
Greetings,
Mattias
Mattias.Campe Guest
-
creating a multidimensional array
How can I combine two arrays in cfscript to form one multidimensional array? For example, I have two arrays: firstarray=fred; firstarray=jim;... -
Problem with multidimensional array
Hi! I'm new on this forum, and in the Macromedia Flash development. I've read some books, like the Flash MX 2004 game development (C. S. Murray,... -
copying a multidimensional array
Hi: whatz the best way to copy an multidimensional array onto another. I have never used something like clone, just want to know whatz the easiest... -
Split multidimensional array into 4 multidimensional arrays
Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the... -
Sorting a Multidimensional Array
I have an array like this: $events = array( array( '2003-07-01', 'Event Title 1', '1' //ID Number (not unique) ), array( '2003-07-02', -
Jon Kraft #2
Re: Multidimensional array: see if 1st key is available
"Mattias.Campe" <MattiasDotNoSpamPlzThankYouCampe@UGent.be> wrote:
array_key_exists()> I've got an multidimensional array
> $ret = $country_code[$countryCode][$langCode];
>
> Now I want to see if $countryCode is even in that array, because if it's
> not, it doesn't make many sense to look further for $langCode.
[url]http://uk.php.net/manual/en/function.array-key-exists.php[/url]
HTH;
JOn
Jon Kraft Guest
-
Mattias.Campe #3
Re: Multidimensional array: see if 1st key is available
Jon Kraft wrote:
Perfect! Thx Jon!> "Mattias.Campe" <MattiasDotNoSpamPlzThankYouCampe@UGent.be> wrote:
>
>>>>I've got an multidimensional array
>>$ret = $country_code[$countryCode][$langCode];
>>
>>Now I want to see if $countryCode is even in that array, because if it's
>>not, it doesn't make many sense to look further for $langCode.
>
> array_key_exists()
>
> [url]http://uk.php.net/manual/en/function.array-key-exists.php[/url]
Greetings,
Mattias
Mattias.Campe Guest



Reply With Quote

