RSS
 

Posts Tagged ‘language’

PHP Human File Size Function

19 Nov

Just found myself needing to display bytes in a human readable format. There are countless examples that use a lot of complex techniques to achieve this, but I wanted a simpler solution. This is the method that came to mind. Rather than basing my algorithm on the numeric value, it is based on the length of the bytes.

Read the rest of this entry »

 
1 Comment

Posted in PHP

 

PHP Uppercase Sentences

14 Nov

I’ve never really had a need to write code to uppercase only sentences in a string, but I now am dealing with large blocks of text content that is often written all uppercase by the author. So I popped on over to the PHP manual. I was pretty certain no such function existed in the language, but thought I’d check if one was added in a newer version.

Alas, no such function existed, so I wrote one myself Read the rest of this entry »

 
2 Comments

Posted in PHP