开发者

how can i access a variable defined inside a for each loop outside the loop?

Here is my code...

foreach ($relatedStories->getResults() as $story):
    $total+=$story->getEstimation();
endforeach;

$$relatedStories is an array of values.im summing the attribute开发者_开发问答 estimation to total. Now i need to access the total value outside. How can i do so????


Define variable $total outside the loop. ($total = 0;).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜