3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="utf-8"?> <toflag> <flagarea formulaid="1" eventid="100" sessionid="421" sectionid="180001" floorid="180001" zoneid="180001" categoryid="180001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="207" sessionid="423" sectionid="180001" floorid="180001" zoneid="180001" categoryid="180001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="94" sessionid="117" sectionid="170001" floorid="0" zoneid="170001" categoryid="170001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="120" sessionid="155" sectionid="170001" floorid="0" zoneid="170001" categoryid="170001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> </toflag> XML; $dom = new DOMDocument; $dom->loadXML($xml); $dom->formatOutput = true; $xpath = new DOMXpath($dom); $query = '/toflag/flagarea[@formulaid="1" and @eventid="207" and @sessionid="423" and @sectionid="180001" and @floorid="180001" and @zoneid="180001" and @categoryid="180001"]/flagbloc[@priceid="4410026"]'; $result = $xpath->query($query); if ($result->length) { $flagBloc = $result->item(0); var_dump($flagBloc->nodeValue); $flagBloc->nodeValue = intval($flagBloc->nodeValue, 10) + 1; } echo $dom->saveXML();

preferences:
43.81 ms | 402 KiB | 5 Q