arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zvonko

    #1

    arrays

    Hi!

    How to create one array that will hold numbers from 3 to 50, their
    square roots, and number * 10?

    example: 3, 1.43, 30
    4, 2, 40


    Thanks


  • Sandman

    #2
    Re: arrays

    In article <452216cd$1@ns1 .novi-net.net>,
    "Zvonko" <zvonko_NOSPAM_ @velkat.netwrot e:
    Hi!
    >
    How to create one array that will hold numbers from 3 to 50, their
    square roots, and number * 10?
    >
    example: 3, 1.43, 30
    4, 2, 40
    >
    >
    Thanks
    <?
    for ($a=3;$a<=50;$a ++){
    $data[] = array($a, sqrt($a), $a*10);
    }
    ?>

    OUT:
    Array
    (
    [0] =Array
    (
    [0] =3
    [1] =1.732050807568 9
    [2] =30
    )

    [1] =Array
    (
    [0] =4
    [1] =2
    [2] =40
    )
    [...and so on]
    )

    --
    Sandman[.net]

    Comment

    Working...