- simplexml_load_string: documentation ( source)
<?php
$data = '<?xml version="1.0" encoding="utf-8" ?>
<note>
<to>
<form>heslo0</form>
<heading>A</heading>
<body>C</body>
</to>
<to>
<form>heslo1</form>
<heading>A</heading>
<body>F</body>
</to>
</note>';
$xml = simplexml_load_string($data);
foreach ($xml->to as $to){
if ($to->form == 'heslo0' && $to->heading == 'A'){echo "povoleno";}
elseif ($to->form == 'heslo0' && $to->heading == 'B'){echo "nepovoleno";}
elseif ($to->form == 'heslo0' && $to->heading == 'C'){echo "blokováno";}
} // po sem se splní a vypíše "povoleno"
foreach ($xml->to as $to){
if ($to->form == 'heslo2' && $to->heading == 'A'){echo "povoleno";}
elseif ($to->form == 'heslo2' && $to->heading == 'B'){echo "nepovoleno";}
elseif ($to->form == 'heslo2' && $to->heading == 'C'){echo "blokováno";}
} // tady už neexistuje daný blok, tak bych chtěl vypsat hlášku třeba "neaktivní"
?>