开发者

Using Same Value of Key in Same Array

How do I write this code correctly? The fourth line, I want to use the values of the 开发者_JAVA技巧two first keys all within the same array.

$pixel_percents = array(
    "complete"=>.5 * 768,
    "wip"=>round(.2 * 768, 0, PHP_ROUND_HALF_DOWN),
    "remain"=>$pixel_percents["complete"] - $pixel_percents["wip"]
);


Just do it after

$pixel_percents = array(
    "complete"=>.5 * 768,
    "wip"=>round(.2 * 768, 0, PHP_ROUND_HALF_DOWN),
);
$pixel_percents['remain'] = $pixel_percents['complete'] - $pixel_percents['wip'];


$pixel_percents = array();
$pixel_percents["complete"] = .5 * 768;
$pixel_percents["wip"] = round(.2 * 768, 0, PHP_ROUND_HALF_DOWN);
$pixel_percents["remain"] = $pixel_percents["complete"] - $pixel_percents["wip"];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜