Posts Tagged ‘wordpress’

Global variable scope in PHP

Wednesday, June 11th, 2008 by Agro Rachmatullah

I need to do some WordPress hacking so I’m actually playing around with PHP at this time. What surprised me recently was that this code doesn’t work as I expected:

$foo = 1;
function bar()
{
   var_dump(isset($foo));
}
bar(); // gives bool(false)

It turns out that in PHP global variables are not automatically available inside functions, to prevent accidental overriding. (I have a C-ish background) To use a global variable inside a function, we need to use the global keyword:

(more…)

Mathematical integral Gravatar image: What’s the rating?

Monday, June 9th, 2008 by Agro Rachmatullah

I just added an image to Gravatar so that it will appear as my avatar when I comment on blogs. It’s just exactly my old WordPress.com avatar, the mathematical integral image. When adding, I met this amusing screen midway:

Adding an integral image to Gravatar

(more…)

Things to do when and after installing WordPress

Saturday, June 7th, 2008 by Agro Rachmatullah

A Wordpress address using a non-pretty URL

Here are some stuffs that I did for my WordPress installations. The plain installation, left alone, is just plainly not good enough :)… I use version 2.5.1 btw.

(more…)