Skip to content

Instantly share code, notes, and snippets.

@qst-exe
Last active July 13, 2021 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qst-exe/0c03a05bb907b77710cf3842a681ab46 to your computer and use it in GitHub Desktop.
Save qst-exe/0c03a05bb907b77710cf3842a681ab46 to your computer and use it in GitHub Desktop.
<?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