periodic_table.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 306 行 · 第 1/2 页
PHP
306 行
<?php//// +----------------------------------------------------------------------+// | PHP Version 4 |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2003 The PHP Group |// +----------------------------------------------------------------------+// | This source file is subject to version 2.0 of the PHP license, |// | that is bundled with this package in the file LICENSE, and is |// | available at through the world-wide-web at |// | http://www.php.net/license/2_02.txt. |// | If you did not receive a copy of the PHP license and are unable to |// | obtain it through the world-wide-web, please send a note to |// | license@php.net so we can mail you a copy immediately. |// +----------------------------------------------------------------------+// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |// +----------------------------------------------------------------------+//// $Id: Periodic_Table.php,v 1.4 2003/01/04 11:56:25 mj Exp $//require_once "Science/Chemistry.php";/** * Utility class that defines a Periodic Table of elements * * @author Jesus M. Castagnetto <jmcastagnetto@php.net> * @version 1.0 * @access public * @package Science_Chemistry */class Science_Chemistry_Periodic_Table { /** * The associative array containing the chemical elements * * @var array * @access public */ var $periodic_table = array(); /** * Returns a Science_Chemistry_Element object correspoding to the symbol (case sensitive) * * @param string $symbol * @return object Science_Chemistry_Element * @access public */ function getElement($symbol) { if (empty($this->periodic_table)) initTable(); $elem = $this->periodic_table[$symbol]; if (Science_Chemistry_Element::isElement($elem)) return $elem; else return null; } /** * Returns an array of Science_Chemistry_Element objects belonging to an element family * * @param string $family * @return array Science_Chemistry_Element objects * @access public */ function getElementFamily($family) { if (empty($this->periodic_table)) initTable(); $elemlist = array(); foreach ($this->periodic_table as $sym=>$elem) if ($elem->family == $family) $elemlist[$sym] = $elem; return $elemlist; } /** * Initializes the Periodic Table array * * @access public */ function initTable() { $periodic_table["H"] = new Science_Chemistry_Element("H", "Hydrogen", 1,1.0079, "-255.34", "-252.87", ""); $periodic_table["He"] = new Science_Chemistry_Element("He", "Helium", 2,4.00260, "< -272.2", "-268.934", "Noble gas"); $periodic_table["Li"] = new Science_Chemistry_Element("Li", "Lithium", 3,6.941, "180.54", "1342", "Alkaline"); $periodic_table["Be"] = new Science_Chemistry_Element("Be", "Beryllium", 4,9.01218, "1278", "2970", "Alkaline Earth"); $periodic_table["B"] = new Science_Chemistry_Element("B", "Boron", 5,10.81, "2079", "2550", ""); $periodic_table["C"] = new Science_Chemistry_Element("C", "Carbon", 6,12.011, "3550", "4827", ""); $periodic_table["N"] = new Science_Chemistry_Element("N", "Nitrogen", 7,14.0067, "-209.86", "-195.8", ""); $periodic_table["O"] = new Science_Chemistry_Element("O", "Oxygen", 8,15.9994, "-218.4", "-182.962", ""); $periodic_table["F"] = new Science_Chemistry_Element("F", "Fluorine", 9,18.9984, "-219.62", "-188", "Halogen"); $periodic_table["Ne"] = new Science_Chemistry_Element("Ne", "Neon", 10,20.179, "-248.67", "-246.048", "Noble gas"); $periodic_table["Na"] = new Science_Chemistry_Element("Na", "Sodium", 11,22.9898, "97.81", "882.9", "Alkaline"); $periodic_table["Mg"] = new Science_Chemistry_Element("Mg", "Magnesium", 12,24.305, "648.8", "1090", "Alkaline Earth"); $periodic_table["Al"] = new Science_Chemistry_Element("Al", "Aluminum", 13,26.9815, "660.37", "2467", ""); $periodic_table["Si"] = new Science_Chemistry_Element("Si", "Silicon", 14,28.0855, "1410", "2355", ""); $periodic_table["P"] = new Science_Chemistry_Element("P", "Phosphorus", 15,30.9738, "44.1", "280", ""); $periodic_table["S"] = new Science_Chemistry_Element("S", "Sulfur", 16,32.06, "112.8 (rhombic); 119.0 (monoclinic)", "4.6", ""); $periodic_table["Cl"] = new Science_Chemistry_Element("Cl", "Chlorine", 17,35.453, "-100.98", "-34", "Halogen"); $periodic_table["Ar"] = new Science_Chemistry_Element("Ar", "Argon", 18,39.948, "-189.2", "-185.7", "Noble gas"); $periodic_table["K"] = new Science_Chemistry_Element("K", "Potassium", 19,39.0983, "63.25", "759.9", "Alkaline"); $periodic_table["Ca"] = new Science_Chemistry_Element("Ca", "Calcium", 20,40.078, "839", "1484", "Alkaline Earth"); $periodic_table["Sc"] = new Science_Chemistry_Element("Sc", "Scandium", 21,44.9579, "1541", "2836", "Transition Metal"); $periodic_table["Ti"] = new Science_Chemistry_Element("Ti", "Titanium", 22,47.88, "1660", "3287", "Transition Metal"); $periodic_table["V"] = new Science_Chemistry_Element("V", "Vanadium", 23,50.9415, "1890", "3380", "Transition Metal"); $periodic_table["Cr"] = new Science_Chemistry_Element("Cr", "Chromium", 24,51.996, "1857", "2672", "Transition Metal"); $periodic_table["Mn"] = new Science_Chemistry_Element("Mn", "Manganese", 25,54.9380, "1244", "1962", "Transition Metal"); $periodic_table["Fe"] = new Science_Chemistry_Element("Fe", "Iron", 26,55.847, "1535", "2750", "Transition Metal"); $periodic_table["Co"] = new Science_Chemistry_Element("Co", "Cobalt", 27,58.9332, "1857", "2672", "Transition Metal"); $periodic_table["Ni"] = new Science_Chemistry_Element("Ni", "Nickel", 28,58.69, "1453", "2732", "Transition Metal"); $periodic_table["Cu"] = new Science_Chemistry_Element("Cu", "Copper", 29,63.546, "1083", "2567", "Transition Metal"); $periodic_table["Zn"] = new Science_Chemistry_Element("Zn", "Zinc", 30,65.38, "419.58", "907", "Transition Metal"); $periodic_table["Ga"] = new Science_Chemistry_Element("Ga", "Gallium", 31,69.72, "29.78", "2403", ""); $periodic_table["Ge"] = new Science_Chemistry_Element("Ge", "Germanium", 32,72.59, "937.4", "2830", ""); $periodic_table["As"] = new Science_Chemistry_Element("As", "Arsenic", 33,74.9216, "817", "613", ""); $periodic_table["Se"] = new Science_Chemistry_Element("Se", "Selenium", 34,78.96, "50 (amorphous); 217 (gray form)", "685", ""); $periodic_table["Br"] = new Science_Chemistry_Element("Br", "Bromine", 35,79.904, "-7.2", "58.78", "Halogen"); $periodic_table["Kr"] = new Science_Chemistry_Element("Kr", "Krypton", 36,83.80, "-156.6", "-152.30", "Noble gas");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?