Categories
PHP

Converting Array to Object in PHP

Here’s a funny little code snippet that demonstrates the flexibility of PHP. Here, we first define an array. Then cast it into an object. And guess what, the keys of the arrays become public variables of the newly created object.

I was impressed to find it out…. Just have a look :

Cool, eh ? 😉

Categories
PHP

A Handy alphabet class :)

Another funny class with no serious use. This is a class I wrote to determine the numerical positions of letters in the English alphabet.

How to use ?

As you can see, using the getNum() method, you can feed a letter and get the serial number or numerical position of that letter. Again in the same way, use the getChar() method to input a number and get the character/letter in that position.

I use it very often while breaking alphabet related codes.

Source Codes:

Categories
PHP

Decoding Google’s Tweet With PHP

This is something for fun — nothing serious. It just happened that Google just sent a mysterious Tweet around 2 hours ago from now with an image with of the Google home page featuring an UFO. The UFO was seen pulling an O out of the google logo. But what the heck does that tweet mean ?

1.12.12 25.15.21.18 15 1.18.5 2.5.12.15.14.7 20.15 21.19 was the tweet.

Well, it’s nothing tough. Every number separated by a dot or space corresponds to the alphabet. So, I wrote a PHP script to decode this mysterious tweet and finally found the meaning:

So, it meant ” all your o are belong to us ” 😉
Sounds a bit odd ? Or wrong in grammar ? yeah, still, that’s the message. It is confirmed on the twitpic image.

And here’s the source code —

It was quite a bit of fun decoding the message with PHP. Well, I do agree that there was no need to use PHP here. But why do the hard work from memory when you have automation tools at your hand 😉 ?