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
Post a Comment