Jump to content

Array Simple Get Data


westman

Recommended Posts

i have a 6 number array separated by (,)for example4,29,70,17,49,51,how do i get my random 6 numbers out the array?i tried...$the_number = explode(",", $number);$number1 = array_slice($the_number, 0, 1);$number2 = array_slice($the_number, 0, 2);$number3 = array_slice($the_number, 0, 3);$number4 = array_slice($the_number, 0, 4);$number5 = array_slice($the_number, 0, 5);$number6 = array_slice($the_number, 0, 6);and it did not work

Link to comment
Share on other sites

$arrayname[0] $arrayname[1]$arrayname[2]$arrayname[3]$arrayname[4]$arrayname[5] you can access the array data like this.

Link to comment
Share on other sites

What's wrong with what i suggested dsonesuk? I didn't get his problem right maybe?
There's nothing wrong with you suggestion, I just provided a way of looping through the array values, and use variable variables to assign values to $num1, $num2.. etc what he asked for in his last post.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...