Sometimes, I find myself facing a language limitation that baffles me. Generally speaking I never hard code any setting in my code. I extract it all into my precious config file (or my config table, material for another post) so that I can change the inner workings of my code. [...]
Currently Browsing
PHP Coding
The great 127.255.255.255 IP enigma!
Hi all, few may have noticed I’ve been rather quiet on my blog lately but I have the best excuse! I’ve been extremely busy working on an important project. Topic of the day: the weird 127.255.255.255 IP I found in my system’s access log. I have a MySQL table with [...]
Converting a String to ROT13 for email obfuscator
A few days ago (weeks? nah) I posted about ROT13 encryption. Since then I’ve been implementing the JQuery ROT13 email obfuscator. I figured I would reuse my code and just add a string to Hex function. Well it did work and here’s me sharing with the world. <?php function stringToHex( [...]
Hex to ASCII to ROT13 in PHP
Couple days ago, a friend posted his status on facebook using a strange code in hexadecimal that didn’t translate from ASCII. I investigated his little code and BEHOLD! I found the solution. So here is the useless function I made to decode his little prank. <?php function HexROT13( $hexedROT13 = [...]
A PHP tale of self awareness
I don’t know about you guys but when I build a system, I like it to be aware of itself. “What the hell do you mean by that?” I hear coming from the back. Here comes my explanation. When I build a system it knows how long each query took [...]
References and object access in PHP
Reading some code this morning I realised that some people use overcomplicated object access syntax. In OOP, some objects can be deep in the structure. Calling their methods or accessing their attributes involves long lines and hard to read code as shown bellow. <?php $fu1 = $someobject->otherone->yetanother->lastone->bar( 1 ); $fu2 [...]
A quick word about readability in PHP
Some people think that code should be something hard to read with little readability. Those people think that only by obfuscating their original source will they gain a sense of security. Inevitably, they eventually pay for this choice. Maintenance is a bitch when you can’t read your source. Here is [...]