<?php
$json = <какой то json>;
$mapstats = json_decode($json, true);
$totalUsed = 0;
foreach ($mapstats as $i) {
$totalUsed += $i['usageCount'];
}
$data = [];
foreach ($mapstats as $value) {
$data[] = [
"name" => $value["map"],
"y" => $value["usageCount"] / $totalCount * 100
];
}
echo json_encode($data);
$sign = base64_encode( sha1(
$private_key .
$data .
$private_key
, 1 ));
<?php
interface SessionInterface
{
public function put($key, $value);
public function push(string $key, $value);
}
class BaseHandler implements SessionInterface
{
public function put($key, $value)
{
echo 'put';
}
public function push(string $key, $value)
{
echo 'push';
}
}
class Session extends BaseHandler
{
public function __construct()
{
echo 'Session...';
}
}
$Session = new Session();
// Можно использовать методы class BaseHandler