This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin load class. | |
* | |
* @author ThimPress | |
* @package LearnPress/Random-Quiz/Classes | |
* @version 3.0.0 | |
*/ | |
// Prevent loading this file directly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = [ 0=>'Q1', 1=>'Q2', 2=>'Q3', 3=>'Q4', 4=>'Q5' ]; | |
$limit = 3; | |
rand_array($array, $limit); | |
function rand_array($array, $number){ | |
print '<pre>'; | |
shuffle($array); | |
print_r( array_values( array_intersect_key( $array, array_flip( array_rand( $array, $number ) ) ) ) ); |