Hi I have this text <lveconfig> <defaults> <cpu limit=" 21"></cpu> <io limit=" 21"></io> <other maxentryprocs=" 20"></other> </defaults> </lveconfig> Code (markup): I would like to get the values cpu limit and io limit from this How can I get it using php ?
Assuming you have the SimpleXML extension: <?php $string = <<<XML <lveconfig> <defaults> <cpu limit=" 21"></cpu> <io limit=" 21"></io> <other maxentryprocs=" 20"></other> </defaults> </lveconfig> XML; $xml = simplexml_load_string($string); $cpuLimit = $xml->defaults[0]->cpu->attributes()->limit; $ioLimit = $xml->defaults[0]->io->attributes()->limit; ?> PHP: