By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

correlation coefficient prob...

P: 2
hello everybody...i m a newbie and struggling with a small assignment which involves
1- creating a dynamic array for floating point numbers
2- comparing adjacent numbers and finding the CORRELATION COEFFICIENT....


can u tell me what functions to use so dat i can start of with?? i wud b rlyyyy grateful...thanxxx
Aug 19 '08 #1
Share this Question
Share on Google+
7 Replies


dlite922
Expert 100+
P: 1,584
do you know PHP?





Dan
Aug 19 '08 #2

P: 2
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
Aug 20 '08 #3

10K+
P: 13,264
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
Start by reading a tutorial on PHP arrays ...
Aug 20 '08 #4

dlite922
Expert 100+
P: 1,584
i do know d basics but d prob is i dnt know how to create a dynamic array...1 dimensional dynamic array for entering float point numbers.....
here's a code to create any array:

[PHP]

//first create the array:
$myArr = array();

//to add a value to the array (push on top/end)
array_push($myArr,"value_here");

// to traverse your array, you can use a for loop
for($i = 0; isset($myArr[$i]); $i++)
{
echo "index $i contains " . $myArr[$i] . "<br />";
}



[/PHP]

With PHP you can mix the any type of variable in the array: you can have an array that contains text, integers , or any number, or boolean value.

Also you do not need to worry about the array size. that is automatically handled.

for more info, refer to:http://php.net/array


Good luck,





Dan
Aug 20 '08 #5

Atli
Expert 5K+
P: 5,058
You shouldn't call array_push to add a single variable to an array.
It is a lot faster to do it like so:
Expand|Select|Wrap|Line Numbers
  1. $array[] = $someVar;
  2.  
array_push should only be used when you need to add multiple elements to an array.
Expand|Select|Wrap|Line Numbers
  1. array_push($array, $var1, $var2, $varN);
  2.  
Aug 20 '08 #6

Markus
Expert 5K+
P: 6,050
Shouldn't that 'PLZ HELP..!!!' be removed?
Aug 20 '08 #7

Atli
Expert 5K+
P: 5,058
Shouldn't that 'PLZ HELP..!!!' be removed?
Good point. It should, and it has been.

siddharthkumarr,

Please avoid putting phrazes like "plz help" in your thread titles. It makes it harder for the other members to spot problems they may be able to help with and it actually makes people less likely to read your thread.

Take a look at the Posting Guidelines please. It's all explained there.

MODERATOR
Aug 20 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.