Reputation: 3414
I want to get table value in php array.
$values=array(2,4,6,8,10,12,14,16,18,19,20);
I tried something like this
<?php
for($i=1;$i<=10;$i++)
{
$values[]=2*$i;
}
?>
Can i do better may be through some built in functions or some another technique.
Upvotes: 0
Views: 166
Reputation: 146490
Assuming that 19 is a typo:
$values = range(2, 20, 2);
Upvotes: 4