Silly mistake

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fredley
Forum Newbie
Posts: 7
Joined: Thu Oct 25, 2007 5:32 am

Silly mistake

Post by fredley »

I'm loading up an array using a loop. It has two tiers, so two while loops using $i and $j. No prizes for guessing what this code does.

Code: Select all

...
$C[$i][$j] = ($first*$fourth - $second*$third)/$determinant;
...
However all I get is an array of 0s. If I echo each term instead of assign it I get the correct output. I also know the array is being created correctly, the values are just not loading in for some reason. Any ideas what's going wrong?

Fred
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You've given us insufficient info. The more data you give the easier the problem is to asses. Try changing that line to see the actual result and post the results.

Code: Select all

var_dump(($first*$fourth - $second*$third)/$determinant);
echo '<br />';
Post Reply