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

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

Thanks Omi Azad

Day before yesterday my friend Omi Azad gave me a fantastic gift. He registered the domain http://hasinhayder.net for 10 years and gave me control to it. I asm so much surprised. He said “Hey hasin, I didn’t give you any wedding gift” – ha ha ha You can find Omi Azad’s blog at http://omiazad.net. Omi … Continue reading Thanks Omi Azad