php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18150 converting functions
Submitted: 2002-07-03 15:48 UTC Modified: 2002-07-09 02:17 UTC
From: hagman at byteme dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hagman at byteme dot com
New email:
PHP Version: OS:

 

 [2002-07-03 15:48 UTC] hagman at byteme dot com
There are some functions to convert time and BinDec etc in PHP but i feel that a whole bunch of functions are missing. for example Temperature Converting functions (eg. included). and for speed, mass, energy etc all of those.

# From Celsius

// To Fahrenheit
function celfar($c) {
return $c*1.8+32; }

// To Kelvin
function celkel($c) {
return $c+273.15; }

// To Rankine
function celran($c) {
return $c*1.8+491.67; }

// To R?aumur
function celrea($c) {
return $c*0.8; }

# From Fahrenheit

// To Celsius
function farcel($f) {
return ($f-32)*(5/9); }

// To Kelvin
function farkel($f) {
return ($f-32)*(5/9)+273.15; }

// To Rankine
function farran($f) {
return $f+459.67; }

// To R?aumur
function farrea($f) {
return ($f-32)*(4/9); }

# From Kelvin

// To Celsius
function kelcel($k) {
return $k-273.15; }

// To Fahrenheit
function kelfar($k) {
return ($k-273.15)*9/5+32; }

// To Rankine
function kelran($k) {
return $k*1.8; }

// To R?aumur
function kelrea($k) {
return ($k-273.15)*0.8; }

# From Rankine

// To Celsius
function rancel($r) {
return ($r*(5/9))-273.15; }

// To Fahrenheit
function ranfar($r) {
return $r-459.67; }

// To Kelvin
function rankel($r) {
return $r*(5/9); }

// To R?aumur
function ranrea($r) {
return ($r*(4/9))-218.52; }

# From R?aumur

// To Celsius
function reacel($re) {
return $re*1.25; }

// To Fahrenheit
function reafar($re) {
return $re*2.25+32; }

// To Kelvin
function reakel($re) {
return $re*1.25+273.15; }

// To Rankine
function rearan($re) {
return $re*2.25+491.67; }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-03 18:30 UTC] sniper@php.net
Like you see, it's easy to do it in PHP. 
We don't really need to have these as builtin functions.
(feel free to create an extension..or something.)

 [2002-07-09 02:17 UTC] philip@php.net
This sorta thing belongs in PEAR, please have a look at the science and math sections in PEAR and ask the PEAR guys for thoughts on the manner.  Here's a start:

  http://cvs.php.net/cvs.php/pear
  http://pear.php.net/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 07:01:31 2024 UTC