Answers for "php faker random from array of numbers"

PHP
3

php get random value from array

$colors=["red","blue","green","orange"];
echo $colors[array_rand($colors)];//green (or any color randomly)
Posted by: Guest on June-02-2021
1

array random php

<?php
$indexedArray = array("red", "blue", "green", "black");

echo $indexedArray[0] . "<br>";
echo $indexedArray[1] . "<br><br>";

$array_random = array_rand($indexedArray, 2);

echo $indexedArray[$array_random[0]] . "<br>";
echo $indexedArray[$array_random[1]] . "<br>";
?>
Posted by: Guest on September-11-2021

Code answers related to "php faker random from array of numbers"

Browse Popular Code Answers by Language