开发者

Separating Arrays As Variables-PHP

How can I use the second array as a seperate variable? and print it as, for example, a link.

My current code is:

$result = $query->product('1149632')开发者_Go百科  
->show(array('name','image','salePrice','url', 'sku'))->query();  

print <<<THIS  
<div>$result</div>  

THIS;  

Thanks


If that $query() method call returns an array, then you can do something like this:

foreach ($result as $val) {
    echo "<div>$val</div>\n";
}


echo"
    <div><a href='{$result['url']}'>{$result['name']}</a> ${$result['salePrice']}</div>  

"; 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜