[ create a new paste ] login | about

Link: http://codepad.org/yn1JUG5U    [ raw code | output | fork ]

PHP, pasted on Sep 6:
1
2
3
4
5
6
7
8
9
10
11
<?php
$numbers1=array('32','16','29','41','36');
$numbers2=array('13','50','47','7','39');
$numbers3=array('3','4','29','35','31');

for($count1=1;$count1<=3;$count1++)
{
    $num1='numbers'.$count1;
    print_r($$num1); //this outputs what's inside all arrays as expected
    echo ${$num1}[0]."\n";
}


Output:
Array
(
    [0] => 32
    [1] => 16
    [2] => 29
    [3] => 41
    [4] => 36
)
32
Array
(
    [0] => 13
    [1] => 50
    [2] => 47
    [3] => 7
    [4] => 39
)
13
Array
(
    [0] => 3
    [1] => 4
    [2] => 29
    [3] => 35
    [4] => 31
)
3


Create a new paste based on this one


Comments: