Jump to content

Check value in array


Cianz

Recommended Posts

Hi - i've read 3 array tutorials now over the last 4 hours but still can't find out how to read the information in the array.

 

Basically I have an array that looks like this;

 

Array
(
    [google.com] => Array
        (
            [0] => 0
            [1] => 29.95
        )

)

 

[0]

will return 0 or 1 depending on wether the domain is available

[1]

will return the price of the domain registration

 

All I want to do is check the value of

[0]

and tell the user wether the domain is available or not. Any help appreciated  ???

Link to comment
https://forums.phpfreaks.com/topic/100566-check-value-in-array/
Share on other sites

$myArray["google.com"][0] = 0;
$myArray["google.com"][1]=29.95;

$myArray["mygoogle.com"][0] = 1;
$myArray["mygoogle.com"][1]=39.95;

echo $myArray["google.com"][0];  //will return 0
echo $myArray["google.com"][1];  //will return 29.95

echo $myArray["mygoogle.com"][0];  //will return 1
echo $myArray["mygoogle.com"][1];  //will return 39.95

Link to comment
https://forums.phpfreaks.com/topic/100566-check-value-in-array/#findComment-514337
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.