PHP code example of php-value-object / temperature

1. Go to this page and download the library: Download php-value-object/temperature 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/ */

    

php-value-object / temperature example snippets

 php
function isItWarm(Temperature $temperature) : bool
{
    $hot = new Celsius(23);
    if($temperature->gte($hot)) {
      return true; // t-shirt time
    }
    
    return false; // jacket time
}

$temperature = new Kelvin(0);
isItWarm($temperature); // false