PHP Get random element out of array 1, show, and move to array 2 -


i'm trying make page when press button randomly returns element out of array1, saves (so can show on page), , moves array2 element doesn't returned second time, have no idea start.

here's source array:

$subject = array (      array("title1","comment1"),      array("title2","comment2"),      array("title3","comment3"),      array("title4","comment4"),  ); 

try these codes:

<?php shuffle( $array1 ); array_push( $array2 , array_pop($array1) ); ?> 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -