ADBRITE ads links
You are here: CodeIdol.com > Php > PHP 5 in Practice > Numbers
PHP 5 in Practice
| 2. Numbers
Being a general-purpose language, PHP has the basic set of mathematical operators and a basic set of mathematical functions. A full list can be found at http://php.net/math. Though it is beyond of the scope of this book, PHP also ...
|
|
| 2.1. Retrieving a Number from a String
When a user enters a number into a form field online, it comes to PHP as a text string. When you want to get the actual number back out as an integer or float, you may have to do some work. Now typically in P...
|
|
| 2.2. Printing Proper Plural Text
If you want to output proper English (or other languages), you need to take into account that, when making a statement involving numbers, the plurality of the text may change. For example, an application may need...
|
|
| 2.3. Converting Numbers into Roman Numerals
Roman numerals are a great way to add a bit of class to a web page. They are often used in official titles, such as the XXXIV Pennsic War (34th). The rules for Roman numerals are straightforward and ther...
|
|
| 2.4. Calculating Interest
A common mathematical problem is calculating the interest on a loan, credit card, or a savings/checking account. Though the basic formula is straightforward, there are many slight variations making it difficult to keep ...
|
|
| 2.5. Simulating Dice
Random number generation is a useful tool that programmers find themselves using regularly. One potential use is to simulate the rolling of dice. The function shown in Listing 2.5.1 allows you to simulate rolling any number of...
|
|
| 2.6. Latitude/Longitude Calculations
Due to the recent popularity of consumer GPS systems, it is likely that you will need to deal with latitude and longitude at some point. Latitude and longitude are a coordinate system for the entire Earth. Lati...
|
|
| 2.7. Metric/English Conversion
For people living in the United States, or those who have to deal with the United States, handling different units of measure is a regular problem.
At the same time, it is useful to be able to convert between any tw...
|
|
| 2.8. Temperature Conversion
Another difference between the United States and most of the world is the reliance on the Fahrenheit temperature scale. Celsius is the most common scale in use elsewhere, and Kelvin and Rankine are used primarily for sc...
|
|
| 2.9. Statistics Package Creation
PHP's math functions (and array functions) are missing a significant set of statistics-based functionality. The common tasks of calculating mean, mode, median, and range of a set of numbers have been left to progra...
|
|
You are here: CodeIdol.com > Php > PHP 5 in Practice > Numbers
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|