SitePoint Member
Arrays IN Php
Currently i got a job and it seems to be one of my major jobs this year though i think i am gradually coming out from the economic meltdown.
In php assuming i wanted to get all the values contained in an array as separate values, how would i do it. My script that echoes all the arrays looks like this...
if (isset($result->Result->marketPrices->runnerPrices->RunnerPrices)) {
echo '
<table class=lightyellow border=1><tr><th colspan=5>getMarketPrices</th></tr><tr><th>runner name</th><th>selection id</th><th>reduction factor</th><th>back prices</th><th>lay prices</th></tr>';
foreach ($result->Result->marketPrices->runnerPrices->RunnerPrices AS $runner) {
echo "<tr><td>".(isset($_SESSION['runnernames'][$runner->selectionId])?$_SESSION['runnernames'][$runner->selectionId]:'unavailable')."</td><td>{$runner->selectionId}</td><td>{$runner->reductionFactor}</td><td>
<a href='$scriptname?action=placetestbet&id=$id&exchangeid=$exchangeid&selectionid={$runner->selectionId}&bettype=B'>[back 2@1000]</a>";
if (isset($runner->bestPricesToBack->Price)) {
foreach ($runner->bestPricesToBack->Price AS $price) {
echo "{$price->amountAvailable}@<b>{$price->price}</b> ";
}
It is a web service stuff so that is why it looks so dirty.
The Bets Prices to Back Contains three values and the prices contains three values as well. How is this thing done.
Thanks to anyone who stops to look at this.
Think i need to come out from my comfort zone.
Last edited by Maximux; Aug 18, 2009 at 18:29 .
Reason: Bug
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks