Let's format that better to understand it:
Code:
$answer = array(
'DomainCheckResult' => array(
'@attributes' => array(
'Domain' => 'mystuff.com',
'Available' => false
)
)
);
This is a multi-dimensional array, meaning arrays inside arrays, so we need to use multiple square brackets:
This will output the string mystuff.com
Code:
echo $answer['DomainCheckResult']['@attributes']['Domain'];
And you can use the true/false value like this:
Code:
if ($answer['DomainCheckResult']['@attributes']['Available']) {
echo $answer['DomainCheckResult']['@attributes']['Domain'] . ' is available.';
} else {
echo $answer['DomainCheckResult']['@attributes']['Domain'] . ' in not available.'];
}
Bookmarks