Skip to content

Instantly share code, notes, and snippets.

@technosophos
Created December 11, 2012 15:00
Show Gist options
  • Save technosophos/4259125 to your computer and use it in GitHub Desktop.
Save technosophos/4259125 to your computer and use it in GitHub Desktop.
Element creation in QP
<?php
//define('QP_NO_AUTOLOADER', TRUE);
require 'src/qp.php';
function examples_qptest() {
$qp = qp("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root/>");
$i = 0;
while ($i < 200) {
$issuerType = rand() ? 'type1' : 'type2';
$firstName = md5(rand(0,100000));
$lastName = md5(rand(700000,90000000));
$qp->append("<test/>")
//->children('Card')
->attr("ID", rand('1000000000000000', '9999999999999999'))
->attr("SomeOtherThing", "6658")
->append('' . $issuerType . '')
->append('091017138')
->append('' . $firstName . '')
->append('' . $lastName . '');
$qp->parent();
$i++;
}
$output = $qp->top()->xml();
print $output;
}
examples_qptest();
@technosophos
Copy link
Author

You might have to adjust the require line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment