PHP random reorder of elements -


I am trying to randomize the order of a series of elements for a website homepage.

We imagine there are 3 titles to display on this page.

  $ title1 = 'first title'; $ Heading 2 = 'second headline'; $ Heading 3 = 'third title';   

We now want to display them on the HTML file but do not repeat one element in a random order and at any time.

  & lt; Html & gt; & Lt; Div id = 'titleholder1' & gt; [Randomly either $ title 1, $ heading 2 or $ heading 3] & lt; / Div & gt; & Lt; Div id = 'titleholder2' & gt; [Randomly either $ title 1, $ heading 2 or $ heading 3] & lt; / Div & gt; & Lt; Div id = 'titleholder3' & gt; [Randomly either $ title 1, $ heading 2 or $ heading 3] & lt; / Div & gt; & Lt; / Html & gt;   

In addition, this page should be repeated by $ title1 $ title2 or $ heading3 any time.

Any ideas,

wonderful

edit.

If we have more than one element, then what we have to do

  $ title1 = 'first title'; $ Info1 = 'first information'; $ Heading 2 = 'second headline'; $ Info2 = 'second information'; $ Heading 3 = 'third title'; $ Info3 = 'third information';   

The same principle clearly requires $ info1 and $ title1 to stay together and manipulate together.

Any idea

text a array In and drag .

  & lt ;? Php $ headline [] = 'one'; $ Headline [] = 'two'; $ Headline [] = 'three'; Shuffle ($ titles); ? & Gt; & Lt; Div class = "titleholder1" & gt; & Lt ;? Php echo $ titles [0] ;? & Gt; & Lt; / Div & gt; & Lt; Div class = "titleholder2" & gt; & Lt ;? Php echo $ titles [1] ;? & Gt; & Lt; / Div & gt; & Lt; Div class = "titleholder3" & gt; & Lt ;? Php echo $ titles [2] ;? & Gt; & Lt; / Div & gt; 

  $ webpage [] = array ('info' = & gt; 'first information', 'Title' = & gt; 'first title'); $ Webpage [] = array ('info' = & gt; 'second information', 'title' = & gt; 'second title'); $ Webpage [] = array ('info' = & gt; 'thrid info', 'title' = & gt; 'third title');    

Comments