<?php

// your code goes here
function sumForArray($v1,$v2)
{
	return array(
		 "charm" => $v1["charm"] + $v2["charm"],
		 "hp" => $v1["hp"] + $v2["hp"],
		);
	
}


$strIN = '[{"charm":1,"hp":1}, {"charm":2,"hp":1}]';
$arrIN = json_decode($strIN, true);
print_r(array_reduce($arrIN,"sumForArray"));