dimanche 27 décembre 2015

PHP Array issue (beginner)

I'm receiving an integer value from my array, instead of a name. How can i correct my code to randomly select a name from the array?

$family = array();
        array_push($family, "joe");
        array_push($family, "bill");
        array_push($family, "carl");
    $sorted = sort($family);
    $select = rand(0, count($sorted) - 1);

    echo $select;




Aucun commentaire:

Enregistrer un commentaire