Jump to content

[SOLVED] Number array


dreamwest

Recommended Posts

What is a simple way of by using php to create a random number based on a array, i can do this with javascript but i need to convert it to php:

 

Javascript random array:

<SCRIPT LANGUAGE="Javascript">
function text() {
};

text = new text();
number = 0;

// textArray
text[number++] = "3894"
text[number++] = "2236"
text[number++] = "4976"
// keep adding items here...

increment = Math.floor(Math.random() * number);

document.write(text[increment]);

//--></SCRIPT>

Link to comment
https://forums.phpfreaks.com/topic/155600-solved-number-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.