Blog Detail
thephpcode
http://thephpcode.blogspot.com/
thephpcode php code resource for all where we have code examples, cool techniques, tricks and sales of codes.
Recent Posts
Getting value from an object (or instance of a class) in PHP 5
Just earlier on I was working on the String class in the Samstyle PHP Framework. I was glad that I read the PHP manual and found this magical method in PHP5 OOP called __toString().Using __toString(), you can actually return a value for the object/in...
jQuery-like chaining in PHP\'s Object Oriented Programming
It's interesting to see how object methods in PHP can be chained just like jQuery's chaining. jQuery's chaining:$("div").children(".firstbtn").hide().fadeIn();In PHP, it is also possible to chain similarly. Using the string class from Samstyle PHP Fr...
file_get_contents() vs fread() - Speed Test and Benchmarking
File access is commonly found in any PHP application. Be it caching, or reading data from a file or what. Lately I've been wondering, whether the use of file_get_contents() over fread() is a good practice (i always prefer file_get_contents()).So this...
Using Bit Shifting to Divide / Multiply
To think of it, I rarely use bitwise operators in my coding - especially with all the convenience of other operators (can you imagine calculating bits whole day?).But seriously when I was reading on Bitwise operators, I realised that ($n / 2) == ($n ...
Pre vs Post Increment in PHP
Earlier on I was browsing Google Code, and I chanced upon JSpeed - a javascript optimizer. I saw that they actually change post increments to pre-increments. I wondered why and thought I could ask this on Stack Overflow.One theory came up to be "prei...
Session Denial: session id contains illegal characters
This morning I woke up, went over to StackOverflow (Yes I admit lately I've been quite active answering questions on SO) and I saw this question: Session hijacking or attack?The asker, Toto, saw these in his error logs:[22-Sep-2009 21:13:52] PHP Warn...

