Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php declare(strict_types=1);
$property_list = [
[
"name" => "物件A",
"price" => 50000000,
"income" => 5000000,
"expenses" => 1000000,
"purchaseExpenses" => 3000000,
],
[
"name" => "物件B",
"price" => 40000000,
"income" => 1800000,
"expenses" => 390000,
"purchaseExpenses" => 1000000,
],
];
foreach ($property_list as $property) {
$grossRate = number_format(($property['income'] / $property['price']) * 100, 1);
$netRate = number_format((($property['income'] - $property['expenses']) / ($property['price'] + $property['purchaseExpenses'] )) * 100, 1) ;
echo $property['name'] . PHP_EOL;
echo "表面利回り ${grossRate}%" . PHP_EOL;
echo "実質利回り ${netRate}%" . PHP_EOL . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment