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. Link to comment https://forums.phpfreaks.com/topic/95324-scope-of-arrays/ 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. Link to comment https://forums.phpfreaks.com/topic/95324-scope-of-arrays/#findComment-488257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.