ivytony Posted March 10, 2008 Share Posted March 10, 2008 I have below question about the scope of arrays. <?php $sale = array('One' => 200, 'Two' => 300, 'Three' => 400, 'Five' => 500, ); $taxrate = array('One' => 0.067, 'Two' => 0.087, 'Three' => 0.080, 'Five' => 0.081, ); foreach($sale as $key => $value) { $tax = $taxrate[$key] * $sale[$key]; echo '$tax is: '. $tax.'| $sale is: '. $sale[$key]. '<br />'; } ?> This generates correct results from the $key. However, this below array doesn't give correct results. Quote Link to comment Share on other sites More sharing options...
Cardale Posted March 10, 2008 Share Posted March 10, 2008 I'm confused about what your trying to do exactly can you explain a little better I will try and help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.