PHP code example of binghua / turnipscalculate

1. Go to this page and download the library: Download binghua/turnipscalculate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

binghua / turnipscalculate example snippets


use BingHua\TurnipsCalculate\TurnipsFactory;

public function __construct(TurnipsFactory $turnipsFactory)
    {
        $this->turnipsFactory = $turnipsFactory;
    }

    public function create()
    {
        $type = '好的大頭菜'
        //$type = '壞掉的大頭菜'
        $price = 400;
        $count = 10
        return $this->turnipsFactory::factory($type, $price, $count)->calculatePrice();
    }