开发者

Using Same Value of Key in Same Array

开发者 https://www.devze.com 2023-04-06 22:12 出处:网络
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.

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

精彩评论

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