WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder



Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Temperature Conversion
Categories : PHP, Math., Beginner Guides Click here to Update Your Picture
Murray Moffatt
Date : Aug 02nd 2005
Grade : 2 of 5 (graded 2 times)
Viewed : 15454
File : 4209.php
Images : No Images for this code example.
Search : More code by Murray Moffatt
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php
/*
Title: Temperature Conversion

Description: Convert celsius to fahrenheit and
fahrenheit to celsius.

Author: Murray Moffatt for A Web 4 U Designs

History:
2005-03-15 : Initial coding.
*/

function temp2celsius ($fahrenheit, $precision = 0) {
// Convert the supplied temperature in celsius to
// fahrenheit and return the value. Specify the required
// precision to round the converted value to.
// Returns FALSE on error.

if (!isset($fahrenheit)) return FALSE;
$precision = (integer)$precision;
$celsius = (float)(($fahrenheit - 32) / 1.8 );
return round($celsius, $precision);
}

function temp2fahrenheit ($celsius, $precision = 0) {
// Convert the supplied temperature in fahrenheit to
// celsius and return the value. Specify the required
// precision to round the converted value to.
// Returns FALSE on error.

if (!isset($celsius)) return FALSE;
$precision = (integer)$precision;
$fahrenheit = (float)(1.8 * $celsius) + 32;
return round($fahrenheit, $precision);
}

echo "<p>50F is " . temp2celsius(50) . "C</p>";
echo "<p>50C is " . temp2fahrenheit(50) . "F</p>";
?>



Reverse a given number
Categories : PHP, Beginner Guides, Algorithms, Math.
Add, Edit /Update & Delete all in one Contact Management Form
Categories : PHP, MySQL, Databases, Beginner Guides
Easy to use random number function that seeds with uniqid and allows a max value
Categories : Math., PHP
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics
Form Validation Using PHP to highlight non valid fields
Categories : PHP, Form Processing, Data Validation, Beginner Guides
Calculator for Baroque Violin strings
Categories : Math., PHP, Strings
Simple Cookie example
Categories : PHP, Beginner Guides, Cookies
a PHP Function to Get only the filename (remove the extension) using regular expressions.
Categories : PHP, Regexps, Beginner Guides
Newbie Notes #7 - Ridiculous regex
Categories : PHP, Beginner Guides, Regexps
Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides
decoct -- Decimal to octal
Categories : PHP, PHP Functions, Math.
PHP Image Validation Class - test if a specific file is of a certain image type without relying on the said file extension.
Categories : PHP, PHP Classes, Data Validation, Graphics, Beginner Guides
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Upload Via FTP - an alternative to move_uploaded_file
Categories : PHP, FTP, Beginner Guides
Cut your MySQL Connections to 1 line of code
Categories : PHP, Beginner Guides, Databases, MySQL