You Are Here Home > July 2008

July 2008

Toolbar Junkies

One of my clients was buying Stumble traffic and as soon as he stopped doing it, Alexa rank for his site dropped by 1000s.
We think this is because users with Stumble toolbar tend to have Alexa toolbar too. (and probably other toolbars)
:)

Toolbar Junkies
Comments (0)   Filed under: SEO, Search Engines   Posted by: Codehead on July 28, 2008

Accessing single character inside PHP strings

In PHP5 you don’t do it like

$char = $string{2};

Do it like:

$char = $string[2];

The curly braces syntax is deprecated!

Accessing single character inside PHP strings
Comments (0)   Filed under: PHP, Web Development   Posted by: Codehead on July 25, 2008

Generating an array of months

Here is a nice way of doing this:

for( $i = 0; $i < 12; $i++ ) {
    $retval[ $i ] =
       date('M', strtotime('Jan +' .$i .' month'));
}

The real power of this is when you put it in a function like this:

function get_months($format) {
   $retval = array();
   for( $i = 0; $i < 12; $i++ ) {
      $retval[ $i ] =
         date($format, strtotime('Jan +' .$i .' month'));
    }
   return $retval;
}

And calling it like this:

$list_of_months_short_text = get_months('M');
$list_of_months_full_text  = get_months('F');
Generating an array of months
Comments (0)   Filed under: PHP, Web Development   Tags: ,   Posted by: Codehead on July 14, 2008