Counting occurrence of a word in a String :: Benchmarking of PHP functions

Today I was just thinking what are the possible ways to count the occurrence of a specific word inside a string. I found some possible ways finally and I just benchmarked them. Wanna see the result?? – for sure you will find it interesting too. <? function microtime_float() {    list($usec, $sec) = explode(” “, microtime());    return ((float)$usec + (float)$sec); } $str = “I have three PHP books, first one is ‘PHP Tastes Good’, next is ‘PHP in your breakfast’ and the last one is ‘PHP Nightmare’”; $start = microtime_float(); for ($i=0; $i<10000; $i++) { … Continue reading Counting occurrence of a word in a String :: Benchmarking of PHP functions

My book “WordPress Complete” has been slashdotted 8

Today I get the news from my Editor at Packt Publishing, David Barnes that my book “WordPress Complete” has been reviewed today in slashdot and scored 8 out of 10 — I am very happy today. You can visit it from here http://books.slashdot.org/article.pl?sid=07/04/25/1554235 And you can buy the book from here WordPress Complete at Amazon … Continue reading My book “WordPress Complete” has been slashdotted 8

Prelude to foundation: Its time to go for a better PHP Framework

I remember those old days when I had to write everything by myself. I wrote huge libraries to work with MySQL. Then I learned PostgreSQL and SQLite but didn’t rewrote my old library to work with those, I was running short of time. So I forsake the opportunity to write a db library which works with them. What I did was plain code relevant to database specific portions. Oh ya, that was a long time ago.

Soon after that I came to know adoDB which made my dream come true. I was so much happy getting my all db specific works done in a much more smarter way. I get rid of database portability issues. I was very happy that time.

I learned smarty soon after I realize that my codes are getting ugly with all the inline HTMLs and PHPs. Nothing could be smarter than separating the presentation logic from the business layer. I am a big smarty fan since that time. It saves my sleep for many nights.

But again I am recurrently suffering from maintainability issues. I was not surprised to find that my code is becoming huge unmanageable giant and it takes huge time for refactoring the application. I was very sad those days. Oh what a disaster that was.

When working with my team members located remote places, I fall into a deep shit. How can we manage and track the changes done by us? Even I was getting strange code in my routine which I bet was not written by me!! It was a terrific job Continue reading “Prelude to foundation: Its time to go for a better PHP Framework”

Dear Almighty

Dear Almighty, Have I told you lately that I love you Have I told you theres no one else above you Fill my heart with gladness Take away all my sadness Ease my troubles thats what you do For the morning sun in all its glory Greets the day with hope and comfort too You … Continue reading Dear Almighty

Vulnerable bug in CodeIgniter which took us hours to fix our corrupted database

We use codeigniter internally to develop our web solutions in somewhere in… net limited. Day before yesterday we suffered a terrible situation for an internal bug in code igniter which corrupted data inside some tables of our application database and then it tooks hours to find the origin of that bug, to fix it and … Continue reading Vulnerable bug in CodeIgniter which took us hours to fix our corrupted database