Foreach设置为null所有变量DOMDocument

时间:2014-12-08 13:45:52

标签: php xml symfony

$xml = new \DOMDocument("1.0", "UTF-8");
    $xmlItem = $xml->createElement("item");
    /** @var \DOMElement $xmlItem */
    $item = $xml->appendChild($xmlItem);
    $item->setAttribute("item-id:2", "abcd");
    $temp = $item->attributes;

    foreach ($temp as $attributeName => $attrValue) {
        $someValue = 2;
        $h = $attributeName;
        $theCurrent = $xmlItem->getAttribute($attributeName);
    }    

然后我去foreach里面的第一行所有变量设置为null e.c. ($ item = null,$ temp = null),脚本因错误而停止: 警告:AdLabs \ PricegeneratorBundle \ PriceGenerators \ Generators \ Google \ Facade :: run():尚未在/home/egor/PhpstormProjects/priceGenerator/src/src/AdLabs/PricegeneratorBundle/PriceGenerators/Generators/Google/Facade.php中实现36 第36行:$ someValue = 2;
请帮助我,我做错了什么?

0 个答案:

没有答案