“tableau aléatoire PHP” Réponses codées

tableau de php aléatoire

<?php
$indexedArray = array("red", "blue", "green", "black");
echo $indexedArray[array_rand($indexedArray)];
?>

Choisissez un mot aléatoire dans un tableau PHP

$items = array(1, 2, 3, 4, 5);
echo $items[array_rand($items)];
Jumping Boy

php obtient un élément aléatoire du tableau

<?php
//array_rand ( array $array [, int $num = 1 ] ) 
$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
echo $input[$rand_keys[1]] . "\n";
?>

Alberto Peripolli

PHP obtient une valeur aléatoire du tableau

$colors=["red","blue","green","orange"];
echo $colors[array_rand($colors)];//green (or any color randomly)
Friendly Hawk

PHP Nombre aléatoire

rand(0,10);
or
random_int(0,10)
hateschoollovecoding

tableau aléatoire PHP

$array = ["a", "b", "c"];
$random = $array[ Rand(0, count($array)-1) ];

echo $random; // a or b or c
hirohito

Réponses similaires à “tableau aléatoire PHP”

Questions similaires à “tableau aléatoire PHP”

Plus de réponses similaires à “tableau aléatoire PHP” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code