I have the below function which will ask one of the questions of the array by random, and the answer must be sent to the database along with the index number of the asked question to be saved and used again on an event like password recovery etc...
My problem is I havent been able to find a method or option to use for getting both the index number and the question to be asked together.
I have tried the key, search_array and other ways but to no avail yet.
Please help
Thanks
<?php
function secQ(){
$questions = array();
$questions[0] = "first question";
$questions[1] = "second question";
$questions[2] = "third question";
$questions[3] = "fourth question";
$questions[4] = "fifth qestion";
$questions[5] = "sixth question";
$rand_keys = array_rand($questions, 2);
}
?>
Aucun commentaire:
Enregistrer un commentaire