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"];
精彩评论