How can PHP be used to ping an IP address obtained from an XML file?

To ping an IP address obtained from an XML file using PHP, you can first parse the XML file to extract the IP address, then use the `exec()` function to execute the `ping` command with the extracted IP address as an argument. This will send an ICMP echo request to the IP address and receive an ICMP echo reply if the address is reachable.

<?php
// Load the XML file
$xml = simplexml_load_file('data.xml');

// Extract the IP address from the XML file
$ip = (string) $xml->ip_address;

// Ping the IP address
$result = exec("ping -c 4 $ip");

// Output the result
echo $result;
?>