|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-28 16:23 UTC] sniper@php.net
[2005-07-28 16:32 UTC] ray-chords at gmx dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
Description: ------------ Intention was to compare a string value with an xml node value. But direct access to the value fails. Reproduce code: --------------- <?php $xml_string = <<<EOD <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?> <document> <command default="yes"><id><![CDATA[li]]></id></command> <command><id><![CDATA[reg]]></id></command> <command><id><![CDATA[cq]]></id></command> <command><id><![CDATA[tipp]]></id></command> <command><id><![CDATA[pwd]]></id></command> </document> EOD; $xml = simplexml_load_string($xml_string); $template = $xml->xpath('/document/command/id'); foreach ($template as $v) { $out = ($v->id == 'pwd') ? 'OK' : 'FALSE'; print $out . "\n"; } ?> Expected result: ---------------- I'd expected an 'OK' in the last loop. But I always get 'FALSE'.