Search found 5 matches

by Cyanide_Pierce
Wed Nov 09, 2011 10:47 am
Forum: PHP - Code
Topic: How to Return a 2 dimentional array and get values
Replies: 8
Views: 849

Re: How to Return a 2 dimentional array and get values

Thank you got it working. I needed to pass the $i through for counting each year. The $years values was where the loop had to stop

Thanks againg
by Cyanide_Pierce
Wed Nov 09, 2011 10:40 am
Forum: PHP - Code
Topic: How to Return a 2 dimentional array and get values
Replies: 8
Views: 849

Re: How to Return a 2 dimentional array and get values

i have that but how do i get it to work in the for loop now? if($option == 1){ echo "<p>\n\t"; for($i = 1; $i <= $years; $i++){ $holis = setMonth(); <---- HERE IS WHERE IM HAVING THE PROBLEMS $total = $total + $holis[$i][1]; echo "Year $i holidays are in {$holis[$i][0]} and you get {$...
by Cyanide_Pierce
Wed Nov 09, 2011 10:25 am
Forum: PHP - Code
Topic: How to Return a 2 dimentional array and get values
Replies: 8
Views: 849

Re: How to Return a 2 dimentional array and get values

months are now gloabal but still dont know how to send the array back and assign the array
by Cyanide_Pierce
Wed Nov 09, 2011 10:21 am
Forum: PHP - Code
Topic: How to Return a 2 dimentional array and get values
Replies: 8
Views: 849

Re: How to Return a 2 dimentional array and get values

The months are defined outside the for.
But how do i return stuff? does return($holis); work for the array? and if so how do i grab them in the for loop
by Cyanide_Pierce
Wed Nov 09, 2011 9:20 am
Forum: PHP - Code
Topic: How to Return a 2 dimentional array and get values
Replies: 8
Views: 849

How to Return a 2 dimentional array and get values

Im using the following code quite often and wish to take some of the code and put it into a function and call the funtion and still output the array data. This is what i have: for($i = 1; $i <= $years; $i++) { $month = rand(1, 3); if($month == 1) { $holis[$i][0] = "April"; $holis[$i][1] = ...