Search the Community
Showing results for tags 'create'.
The search index is currently processing. Current results may not be complete.
Hi guys, I try to build an xml document with php. Creating, saving and sending works fine. Just couldnt figure out how to insert a variable to my php-code, which creates the xml. <?php$xml = new DOMDocument("1.0", "utf-8";$root = $xml->createElement("ABC");$xml->appendChild($root);$var1 = $xml->createElement("Town");$var1Text = $xml->createTextNode('$townname');$var1->appendChild($varText);$BCD = $xml->createElement("Data");$BCD->appendChild($var1);$root->appendChild($BCD);$xml->formatOutput = true;echo "<xmp>". $xml->saveXML() ."</xmp>";$xml-&g
Hello, I'm trying to make a method that creates objects of a parameterized type randomly, but also to store the hashCode of different objects created and if at any time the percentage of different objects is less than 50% throw an exception. This last part is where I've gotten stuck. I have created a population property where I store the different hashCodes and update it in the method adding the new hashCode from the new object. But I don't know how to do for to know if the percentage of different objects is less than 50%. See if someone can help me out. Regards!