<?php
|
/*---------------------------------------------------------------*/
|
/*
|
Titre : Conversion sur 58 dimensions différentes
|
|
URL : https://phpsources.net/code_s.php?id=996
|
Date édition : 15 Fév 2019
|
Date mise à jour : 26 Aout 2019
|
Rapport de la maj:
|
- fonctionnement du code vérifié
|
*/
|
/*---------------------------------------------------------------*/
|
|
function conv_metrique($x , $origine , $destination){
|
$const = array();
|
$const["A"] = 1.00*pow(10, 10);
|
$const["ua"] = 6.69*pow(10, -12);
|
$const["bar"] = 0.0762;
|
$const["bo"] = 2.73*pow(10, -02);
|
$const["cable"] = 0.00456;
|
$const["cm"] = 100;
|
$const["chain1"] = 3.28*pow(10, -02);
|
$const["chain2"] = 0.049709;
|
$const["cub"] = 2.1872;
|
$const["dm"] = 10;
|
$const["Dm"] = 0.1;
|
$const["ell"] = 0.875;
|
$const["fathom"] = 0.546805453;
|
$const["p"] = 3.2813;
|
$const["pb"] = 3.280843;
|
$const["pa"] = 3.280833;
|
$const["fur"] = 0.004971;
|
$const["mn"] = 9.8425;
|
$const["hm"] = 0.01;
|
$const["inchuk"] = 39.3701;
|
$const["inchus"] = 39.37008;
|
$const["km"] = 0.001;
|
$const["n"] = 0.000539665;
|
$const["ln"] = 0.000179866;
|
$const["ls"] = 0.000207;
|
$const["al"] = 1.04949*pow(10, -16);
|
$const["ligne"] = 472.4335;
|
$const["lf"] = 22.5581;
|
$const["linka"] = 3.2808;
|
$const["linkb"] = 0.2011684;
|
$const["Mm"] = 1.00*pow(10, 06);
|
$const["uum"] = 1.00*pow(10, 12);
|
$const["um"] = 1000000;
|
$const["mil"] = 39370;
|
$const["mile"] = 0.00051938;
|
$const["mile b"] = 0.000621373;
|
$const["mile n"] = 0.00054;
|
$const["mile s"] = 0.000621;
|
$const["mm"] = 1000;
|
$const["mum"] = 1.00*pow(10, 09);
|
$const["mym"] = 10000;
|
$const["ob"] = 17.4978;
|
$const["pas"] = 1.31;
|
$const["pasuk"] = 1.31;
|
$const["paume"] = 13.1234;
|
$const["parsec"] = 3.24*pow(10, -17);
|
$const["per"] = 0.198839;
|
$const["picai"] = 236.22048;
|
$const["picap"] = 237.1063;
|
$const["point"] = 2834.6278;
|
$const["rod"] = 0.1988;
|
$const["corde"] = 0.16404;
|
$const["sk"] = 0.00911;
|
$const["cd"] = 1.56*pow(10, 06);
|
$const["yd"] = 1.0936;
|
$const["yduk"] = 1.093614;
|
$const["ydus"] = 1.093611;
|
$const["m"] = 1;
|
|
$nom = array();
|
$nom["A"] = "Angstrom";
|
$nom["ua"] = "unité astronomique";
|
$nom["bar"] = "barleycorn britannique";
|
$nom["bo"] = "bolt américain";
|
$nom["cable"] = "cable";
|
$nom["cm"] = "centimètre";
|
$nom["chain1"] = "chain (engineers ou ramdens)";
|
$nom["chain2"] = "chain (géomètre ou gunters)";
|
$nom["cub"] = "cubit";
|
$nom["dm"] = "decimètre";
|
$nom["Dm"] = "décamètre";
|
$nom["ell"] = "ell";
|
$nom["fathom"] = "fathom";
|
$nom["p"] = "pied";
|
$nom["pb"] = "pied britannique";
|
$nom["pa"] = "pied américain";
|
$nom["fur"] = "furlong";
|
$nom["mn"] = "main";
|
$nom["hm"] = "hectomètre";
|
$nom["inchuk"] = "pouce britannique";
|
$nom["inchus"] = "pouce américain";
|
$nom["km"] = "kilomètre";
|
$nom["n"] = "noeud";
|
$nom["ln"] = "league nautique";
|
$nom["ls"] = "league (statute)";
|
$nom["al"] = "année lumière";
|
$nom["ligne"] = "ligne britannique";
|
$nom["lf"] = "ligne franà§aise";
|
$nom["linka"] = "link (engineers ou ramdens)";
|
$nom["linkb"] = "link (surveyors ou gunters)";
|
$nom["Mm"] = "megamètre";
|
$nom["uum"] = "micromicron";
|
$nom["um"] = "micron";
|
$nom["mil"] = "mil";
|
$nom["mile"] = "mile";
|
$nom["mile b"] = "mile britannique";
|
$nom["mile n"] = "mile nautique";
|
$nom["mile s"] = "mile (statute)";
|
$nom["mm"] = "millimeter";
|
$nom["mum"] = "millimicron";
|
$nom["mym"] = "myriamètre";
|
$nom["ob"] = "ongle britannique";
|
$nom["pas"] = "pas";
|
$nom["pasuk"] = "pas britannique";
|
$nom["paume"] = "paume britannique";
|
$nom["parsec"] = "parsec";
|
$nom["per"] = "perche";
|
$nom["picai"] = "pica (imprimerie)";
|
$nom["picap"] = "pica (imprimante)";
|
$nom["point"] = "point (imprimerie)";
|
$nom["rod"] = "rod (géomètre ou gunters)";
|
$nom["corde"] = "corde britannique";
|
$nom["sk"] = "skein";
|
$nom["cd"] = "longueur d\'onde rouge du cadmium";
|
$nom["yd"] = "yard";
|
$nom["yduk"] = "yard britannique";
|
$nom["ydus"] = "yard américain";
|
$nom['m'] = "mètre";
|
|
if (!in_array($origine, array_keys($const) )){
|
return $nom;
|
}
|
if (!in_array( $destination, array_keys($const))){
|
return $nom;
|
}
|
|
$retour = array();
|
$retour['valeur'] = $x*$const[$destination]/$const[$origine];
|
$retour['nom'] = $nom[$destination];
|
$retour['unite'] = $destination;
|
return $retour;
|
}
|
|
?>
|
|
|