Feed Rss



Mar 24 2008

Simple Modular Arithmetic with Smarty Template Engine

category: PHP,Snippets author:

Something i take for granted in PHP is the use of Modular Arithmetic when display results in a grid like format. Usually in php, i would do something like this to display three items per row if ($count % 3 == 0) { // Add Break / Clear here } So i assumed something like [...]

tag: ,


Feb 27 2008

Var Vars

category: PHP,Snippets author:

Var vars can be very handy, you can use them to associate a name to a variable. <? $my_soon_to_be_variable = 'wow_my_variable'; $$my_soon_to_be_variable = 'Now it's a VAR VAR'; // It's a var var echo $wow_my_variable; // That's right, it's a variable ?>

tag: , ,


Feb 27 2008

Make all letters caps

category: PHP,Snippets author:

A nice little way of making all letters into capitals is to use PHP's inbuilt function strtoupper, like so. echo strtoupper('Hi, i am going to be all in caps in just one mo'); Will print ... HI, I AM GOING TO BE ALL IN CAPS IN JUST ONE MO

tag: , ,