News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Evolt.org:
Working With Fractions In CSS and PHP
February 12, 2007 @ 09:03:00

Evolt.org has an interesting new article posted today about combining CSS and PHP to display fractions correctly on your pages.

Most of us are uncomfortable with using fractions when writing programs. If we encounter a fraction, we will first convert it into a floating point number (with decimals) and proceed from there. Most programming languages would prefer to use 0.5 as opposed to 1/2 because the later might conflict with the syntax of the languages. In this article, I will discuss my attempt to work with fractions in one of the PHP projects that I have done.

They start with the CSS to handle the output before moving into the PHP code. The code given will take in a decimal number and do its best to match it up with a fraction string value out of an array. The result is the echoed out with sup and sub tags to create the correct effect.

0 comments voice your opinion now!
fractions css sup sub html tutorial match array fractions css sup sub html tutorial match array


blog comments powered by Disqus

Similar Posts

Stefan Mischook's Blog: Object Oriented PHP Tutorial Updated - Steps 18 - 22

ProDevTips Blog: Fluent Arrays and Strings in PHP - Adding JSON and more

Zend: Roll Your Own Search Engine with Zend_Search_Lucene

Daniel Cousineau's Blog: ImagePlane and some simple OOP designs

Zend Developer Zone: Reading and Writing Spreadsheets with PHP


Community Events





Don't see your event here?
Let us know!


unittest bugfix release opinion podcast framework series library symfony introduction interview api laravel zendserver language deployment package voicesoftheelephpant community install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework