File indexing completed on 2025-01-26 05:29:41
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Measure 0017 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @license http://framework.zend.com/license/new-bsd New BSD License 0019 * @version $Id$ 0020 */ 0021 0022 /** 0023 * Implement needed classes 0024 */ 0025 // require_once 'Zend/Measure/Abstract.php'; 0026 // require_once 'Zend/Locale.php'; 0027 0028 /** 0029 * Class for handling density conversions 0030 * 0031 * @category Zend 0032 * @package Zend_Measure 0033 * @subpackage Zend_Measure_Density 0034 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0035 * @license http://framework.zend.com/license/new-bsd New BSD License 0036 */ 0037 class Zend_Measure_Density extends Zend_Measure_Abstract 0038 { 0039 const STANDARD = 'KILOGRAM_PER_CUBIC_METER'; 0040 0041 const ALUMINIUM = 'ALUMINIUM'; 0042 const COPPER = 'COPPER'; 0043 const GOLD = 'GOLD'; 0044 const GRAIN_PER_CUBIC_FOOT = 'GRAIN_PER_CUBIC_FOOT'; 0045 const GRAIN_PER_CUBIC_INCH = 'GRAIN_PER_CUBIC_INCH'; 0046 const GRAIN_PER_CUBIC_YARD = 'GRAIN_PER_CUBIC_YARD'; 0047 const GRAIN_PER_GALLON = 'GRAIN_PER_GALLON'; 0048 const GRAIN_PER_GALLON_US = 'GRAIN_PER_GALLON_US'; 0049 const GRAM_PER_CUBIC_CENTIMETER = 'GRAM_PER_CUBIC_CENTIMETER'; 0050 const GRAM_PER_CUBIC_DECIMETER = 'GRAM_PER_CUBIC_DECIMETER'; 0051 const GRAM_PER_CUBIC_METER = 'GRAM_PER_CUBIC_METER'; 0052 const GRAM_PER_LITER = 'GRAM_PER_LITER'; 0053 const GRAM_PER_MILLILITER = 'GRAM_PER_MILLILITER'; 0054 const IRON = 'IRON'; 0055 const KILOGRAM_PER_CUBIC_CENTIMETER = 'KILOGRAM_PER_CUBIC_CENTIMETER'; 0056 const KILOGRAM_PER_CUBIC_DECIMETER = 'KILOGRAM_PER_CUBIC_DECIMETER'; 0057 const KILOGRAM_PER_CUBIC_METER = 'KILOGRAM_PER_CUBIC_METER'; 0058 const KILOGRAM_PER_CUBIC_MILLIMETER = 'KILOGRAM_PER_CUBIC_MILLIMETER'; 0059 const KILOGRAM_PER_LITER = 'KILOGRAM_PER_LITER'; 0060 const KILOGRAM_PER_MILLILITER = 'KILOGRAM_PER_MILLILITER'; 0061 const LEAD = 'LEAD'; 0062 const MEGAGRAM_PER_CUBIC_CENTIMETER = 'MEGAGRAM_PER_CUBIC_CENTIMETER'; 0063 const MEGAGRAM_PER_CUBIC_DECIMETER = 'MEGAGRAM_PER_CUBIC_DECIMETER'; 0064 const MEGAGRAM_PER_CUBIC_METER = 'MEGAGRAM_PER_CUBIC_METER'; 0065 const MEGAGRAM_PER_LITER = 'MEGAGRAM_PER_LITER'; 0066 const MEGAGRAM_PER_MILLILITER = 'MEGAGRAM_PER_MILLILITER'; 0067 const MICROGRAM_PER_CUBIC_CENTIMETER = 'MICROGRAM_PER_CUBIC_CENTIMETER'; 0068 const MICROGRAM_PER_CUBIC_DECIMETER = 'MICROGRAM_PER_CUBIC_DECIMETER'; 0069 const MICROGRAM_PER_CUBIC_METER = 'MICROGRAM_PER_CUBIC_METER'; 0070 const MICROGRAM_PER_LITER = 'MICROGRAM_PER_LITER'; 0071 const MICROGRAM_PER_MILLILITER = 'MICROGRAM_PER_MILLILITER'; 0072 const MILLIGRAM_PER_CUBIC_CENTIMETER = 'MILLIGRAM_PER_CUBIC_CENTIMETER'; 0073 const MILLIGRAM_PER_CUBIC_DECIMETER = 'MILLIGRAM_PER_CUBIC_DECIMETER'; 0074 const MILLIGRAM_PER_CUBIC_METER = 'MILLIGRAM_PER_CUBIC_METER'; 0075 const MILLIGRAM_PER_LITER = 'MILLIGRAM_PER_LITER'; 0076 const MILLIGRAM_PER_MILLILITER = 'MILLIGRAM_PER_MILLILITER'; 0077 const OUNCE_PER_CUBIC_FOOT = 'OUNCE_PER_CUBIC_FOOT'; 0078 const OUNCR_PER_CUBIC_FOOT_TROY = 'OUNCE_PER_CUBIC_FOOT_TROY'; 0079 const OUNCE_PER_CUBIC_INCH = 'OUNCE_PER_CUBIC_INCH'; 0080 const OUNCE_PER_CUBIC_INCH_TROY = 'OUNCE_PER_CUBIC_INCH_TROY'; 0081 const OUNCE_PER_CUBIC_YARD = 'OUNCE_PER_CUBIC_YARD'; 0082 const OUNCE_PER_CUBIC_YARD_TROY = 'OUNCE_PER_CUBIC_YARD_TROY'; 0083 const OUNCE_PER_GALLON = 'OUNCE_PER_GALLON'; 0084 const OUNCE_PER_GALLON_US = 'OUNCE_PER_GALLON_US'; 0085 const OUNCE_PER_GALLON_TROY = 'OUNCE_PER_GALLON_TROY'; 0086 const OUNCE_PER_GALLON_US_TROY = 'OUNCE_PER_GALLON_US_TROY'; 0087 const POUND_PER_CIRCULAR_MIL_FOOT = 'POUND_PER_CIRCULAR_MIL_FOOT'; 0088 const POUND_PER_CUBIC_FOOT = 'POUND_PER_CUBIC_FOOT'; 0089 const POUND_PER_CUBIC_INCH = 'POUND_PER_CUBIC_INCH'; 0090 const POUND_PER_CUBIC_YARD = 'POUND_PER_CUBIC_YARD'; 0091 const POUND_PER_GALLON = 'POUND_PER_GALLON'; 0092 const POUND_PER_KILOGALLON = 'POUND_PER_KILOGALLON'; 0093 const POUND_PER_MEGAGALLON = 'POUND_PER_MEGAGALLON'; 0094 const POUND_PER_GALLON_US = 'POUND_PER_GALLON_US'; 0095 const POUND_PER_KILOGALLON_US = 'POUND_PER_KILOGALLON_US'; 0096 const POUND_PER_MEGAGALLON_US = 'POUND_PER_MEGAGALLON_US'; 0097 const SILVER = 'SILVER'; 0098 const SLUG_PER_CUBIC_FOOT = 'SLUG_PER_CUBIC_FOOT'; 0099 const SLUG_PER_CUBIC_INCH = 'SLUG_PER_CUBIC_INCH'; 0100 const SLUG_PER_CUBIC_YARD = 'SLUG_PER_CUBIC_YARD'; 0101 const SLUG_PER_GALLON = 'SLUG_PER_GALLON'; 0102 const SLUG_PER_GALLON_US = 'SLUG_PER_GALLON_US'; 0103 const TON_PER_CUBIC_FOOT_LONG = 'TON_PER_CUBIC_FOOT_LONG'; 0104 const TON_PER_CUBIC_FOOT = 'TON_PER_CUBIC_FOOT'; 0105 const TON_PER_CUBIC_INCH_LONG = 'TON_PER_CUBIC_INCH_LONG'; 0106 const TON_PER_CUBIC_INCH = 'TON_PER_CUBIC_INCH'; 0107 const TON_PER_CUBIC_YARD_LONG = 'TON_PER_CUBIC_YARD_LONG'; 0108 const TON_PER_CUBIC_YARD = 'TON_PER_CUBIC_YARD'; 0109 const TON_PER_GALLON_LONG = 'TON_PER_GALLON_LONG'; 0110 const TON_PER_GALLON_US_LONG = 'TON_PER_GALLON_US_LONG'; 0111 const TON_PER_GALLON = 'TON_PER_GALLON'; 0112 const TON_PER_GALLON_US = 'TON_PER_GALLON_US'; 0113 const TONNE_PER_CUBIC_CENTIMETER = 'TONNE_PER_CUBIC_CENTIMETER'; 0114 const TONNE_PER_CUBIC_DECIMETER = 'TONNE_PER_CUBIC_DECIMETER'; 0115 const TONNE_PER_CUBIC_METER = 'TONNE_PER_CUBIC_METER'; 0116 const TONNE_PER_LITER = 'TONNE_PER_LITER'; 0117 const TONNE_PER_MILLILITER = 'TONNE_PER_MILLILITER'; 0118 const WATER = 'WATER'; 0119 0120 /** 0121 * Calculations for all density units 0122 * 0123 * @var array 0124 */ 0125 protected $_units = array( 0126 'ALUMINIUM' => array('2643', 'aluminium'), 0127 'COPPER' => array('8906', 'copper'), 0128 'GOLD' => array('19300', 'gold'), 0129 'GRAIN_PER_CUBIC_FOOT' => array('0.0022883519', 'gr/ft³'), 0130 'GRAIN_PER_CUBIC_INCH' => array('3.9542721', 'gr/in³'), 0131 'GRAIN_PER_CUBIC_YARD' => array('0.000084753774', 'gr/yd³'), 0132 'GRAIN_PER_GALLON' => array('0.014253768', 'gr/gal'), 0133 'GRAIN_PER_GALLON_US' => array('0.017118061', 'gr/gal'), 0134 'GRAM_PER_CUBIC_CENTIMETER' => array('1000', 'g/cm³'), 0135 'GRAM_PER_CUBIC_DECIMETER' => array('1', 'g/dm³'), 0136 'GRAM_PER_CUBIC_METER' => array('0.001', 'g/m³'), 0137 'GRAM_PER_LITER' => array('1', 'g/l'), 0138 'GRAM_PER_MILLILITER' => array('1000', 'g/ml'), 0139 'IRON' => array('7658', 'iron'), 0140 'KILOGRAM_PER_CUBIC_CENTIMETER' => array('1000000', 'kg/cm³'), 0141 'KILOGRAM_PER_CUBIC_DECIMETER' => array('1000', 'kg/dm³'), 0142 'KILOGRAM_PER_CUBIC_METER' => array('1', 'kg/m³'), 0143 'KILOGRAM_PER_CUBIC_MILLIMETER' => array('1000000000', 'kg/l'), 0144 'KILOGRAM_PER_LITER' => array('1000', 'kg/ml'), 0145 'KILOGRAM_PER_MILLILITER' => array('1000000', 'kg/ml'), 0146 'LEAD' => array('11370', 'lead'), 0147 'MEGAGRAM_PER_CUBIC_CENTIMETER' => array('1.0e+9', 'Mg/cm³'), 0148 'MEGAGRAM_PER_CUBIC_DECIMETER' => array('1000000', 'Mg/dm³'), 0149 'MEGAGRAM_PER_CUBIC_METER' => array('1000', 'Mg/m³'), 0150 'MEGAGRAM_PER_LITER' => array('1000000', 'Mg/l'), 0151 'MEGAGRAM_PER_MILLILITER' => array('1.0e+9', 'Mg/ml'), 0152 'MICROGRAM_PER_CUBIC_CENTIMETER' => array('0.001', 'µg/cm³'), 0153 'MICROGRAM_PER_CUBIC_DECIMETER' => array('1.0e-6', 'µg/dm³'), 0154 'MICROGRAM_PER_CUBIC_METER' => array('1.0e-9', 'µg/m³'), 0155 'MICROGRAM_PER_LITER' => array('1.0e-6', 'µg/l'), 0156 'MICROGRAM_PER_MILLILITER' => array('0.001', 'µg/ml'), 0157 'MILLIGRAM_PER_CUBIC_CENTIMETER' => array('1', 'mg/cm³'), 0158 'MILLIGRAM_PER_CUBIC_DECIMETER' => array('0.001', 'mg/dm³'), 0159 'MILLIGRAM_PER_CUBIC_METER' => array('0.000001', 'mg/m³'), 0160 'MILLIGRAM_PER_LITER' => array('0.001', 'mg/l'), 0161 'MILLIGRAM_PER_MILLILITER' => array('1', 'mg/ml'), 0162 'OUNCE_PER_CUBIC_FOOT' => array('1.001154', 'oz/ft³'), 0163 'OUNCE_PER_CUBIC_FOOT_TROY' => array('1.0984089', 'oz/ft³'), 0164 'OUNCE_PER_CUBIC_INCH' => array('1729.994', 'oz/in³'), 0165 'OUNCE_PER_CUBIC_INCH_TROY' => array('1898.0506', 'oz/in³'), 0166 'OUNCE_PER_CUBIC_YARD' => array('0.037079776', 'oz/yd³'), 0167 'OUNCE_PER_CUBIC_YARD_TROY' => array('0.040681812', 'oz/yd³'), 0168 'OUNCE_PER_GALLON' => array('6.2360233', 'oz/gal'), 0169 'OUNCE_PER_GALLON_US' => array('7.4891517', 'oz/gal'), 0170 'OUNCE_PER_GALLON_TROY' => array('6.8418084', 'oz/gal'), 0171 'OUNCE_PER_GALLON_US_TROY' => array('8.2166693', 'oz/gal'), 0172 'POUND_PER_CIRCULAR_MIL_FOOT' => array('2.9369291', 'lb/cmil ft'), 0173 'POUND_PER_CUBIC_FOOT' => array('16.018463', 'lb/in³'), 0174 'POUND_PER_CUBIC_INCH' => array('27679.905', 'lb/in³'), 0175 'POUND_PER_CUBIC_YARD' => array('0.59327642', 'lb/yd³'), 0176 'POUND_PER_GALLON' => array('99.776373', 'lb/gal'), 0177 'POUND_PER_KILOGALLON' => array('0.099776373', 'lb/kgal'), 0178 'POUND_PER_MEGAGALLON' => array('0.000099776373', 'lb/Mgal'), 0179 'POUND_PER_GALLON_US' => array('119.82643', 'lb/gal'), 0180 'POUND_PER_KILOGALLON_US' => array('0.11982643', 'lb/kgal'), 0181 'POUND_PER_MEGAGALLON_US' => array('0.00011982643', 'lb/Mgal'), 0182 'SILVER' => array('10510', 'silver'), 0183 'SLUG_PER_CUBIC_FOOT' => array('515.37882', 'slug/ft³'), 0184 'SLUG_PER_CUBIC_INCH' => array('890574.6', 'slug/in³'), 0185 'SLUG_PER_CUBIC_YARD' => array('19.088104', 'slug/yd³'), 0186 'SLUG_PER_GALLON' => array('3210.2099', 'slug/gal'), 0187 'SLUG_PER_GALLON_US' => array('3855.3013', 'slug/gal'), 0188 'TON_PER_CUBIC_FOOT_LONG' => array('35881.358', 't/ft³'), 0189 'TON_PER_CUBIC_FOOT' => array('32036.927', 't/ft³'), 0190 'TON_PER_CUBIC_INCH_LONG' => array('6.2202987e+7', 't/in³'), 0191 'TON_PER_CUBIC_INCH' => array('5.5359809e+7', 't/in³'), 0192 'TON_PER_CUBIC_YARD_LONG' => array('1328.9392', 't/yd³'), 0193 'TON_PER_CUBIC_YARD' => array('1186.5528', 't/yd³'), 0194 'TON_PER_GALLON_LONG' => array('223499.07', 't/gal'), 0195 'TON_PER_GALLON_US_LONG' => array('268411.2', 't/gal'), 0196 'TON_PER_GALLON' => array('199522.75', 't/gal'), 0197 'TON_PER_GALLON_US' => array('239652.85', 't/gal'), 0198 'TONNE_PER_CUBIC_CENTIMETER' => array('1.0e+9', 't/cm³'), 0199 'TONNE_PER_CUBIC_DECIMETER' => array('1000000', 't/dm³'), 0200 'TONNE_PER_CUBIC_METER' => array('1000', 't/m³'), 0201 'TONNE_PER_LITER' => array('1000000', 't/l'), 0202 'TONNE_PER_MILLILITER' => array('1.0e+9', 't/ml'), 0203 'WATER' => array('1000', 'water'), 0204 'STANDARD' => 'KILOGRAM_PER_CUBIC_METER' 0205 ); 0206 }