Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing the rand () php function to display random xml files
    text
    copied!<p>I am trying to write a php that generates xml files randomly. The php would generate a random number between 1-10 inclusive and each number 1-10 would have a xml file assigned to it in the php which would appear when the respective number is generated. </p> <p>So far I have:</p> <pre><code>&lt;?php print rand() . "&lt;br&gt;"; print rand(1, 10); ?&gt; </code></pre> <p>How do I integrate the xml files into this php? Using this xml example:</p> <p><strong>Example 1</strong></p> <pre><code>&lt;?xml version="3.0" encoding="utf-8" ?&gt; &lt;channel&gt; &lt;title&gt;The Dog in the Park&lt;/title&gt; &lt;link&gt;http://pets.com/doginthepark/&lt;/link&gt; &lt;description&gt; The dog in the park &lt;item&gt; &lt;guid&gt;1234&lt;/guid&gt; &lt;title&gt;poodle's video&lt;/title&gt; </code></pre> <p><strong>Example 2</strong> </p> <pre><code>&lt;?xml version="3.0" encoding="utf-8" ?&gt; &lt;channel&gt; &lt;title&gt;The Cat in the Park&lt;/title&gt; &lt;link&gt;http://pets.com/kitteninthepark/&lt;/link&gt; &lt;description&gt; The cat in the park &lt;item&gt; &lt;guid&gt;1235&lt;/guid&gt; &lt;title&gt;kitten video&lt;/title&gt; &lt;item&gt; &lt;guid&gt;123455&lt;/guid&gt; &lt;title&gt;tiger video&lt;/title&gt; </code></pre> <p>So the XML files above have the assigned numbers 1 &amp; 2. How would I assign the number in code to the correct XML and how would I be able to generate a random XML return of the numbers 1-10 which also display the XML file details. </p> <p>Any help will be greatly appreciated! Sorry if this question is obvious, I'm a rookie at this :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload