本文整理汇总了PHP中Bank::addProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Bank::addProducts方法的具体用法?PHP Bank::addProducts怎么用?PHP Bank::addProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bank
的用法示例。
在下文中一共展示了Bank::addProducts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Bank
<?php
require_once 'autoload.php';
$bank = new Bank('The Bank', 'Bulgaria', 1000000);
$bank->addProducts(new Deposit('Short Deposit', 'deposit', 0.03, 3));
$bank->addProducts(new Deposit('Long Deposit', 'deposit', 0.05, 12));
$bank->addProducts(new Credit('Home Credit', 'credit', 0.06));
$bank->addProducts(new Credit('Consumer Credit', 'credit', 0.1));
$clients = [new Client('Client name', 'Address', 10000, 1000), new Client('Client name', 'Address', 20000, 2000), new Client('Client name', 'Address', 30000, 3000), new Client('Client name', 'Address', 40000, 4000), new Client('Client name', 'Address', 50000, 5000), new Client('Client name', 'Address', 60000, 6000), new Client('Client name', 'Address', 70000, 7000), new Client('Client name', 'Address', 80000, 8000), new Client('Client name', 'Address', 90000, 9000), new Client('Client name', 'Address', 100000, 10000)];
foreach ($clients as $k => $v) {
$v->newDeposit($v->getMoney() * rand(80, 100) / 100, $bank->getProducts()[rand(0, 1)], $bank);
}
echo 'The bank has ' . $bank->getMoney() . ' available money and ' . $bank->getReserve() . ' reserve.' . PHP_EOL;
var_dump($clients[0], $clients[1]);