Lets Appear on the blog Vijay

January 11, 2007

So finally I have snap of mine which I am posting on the blog here.
vijay-big.jpg


PHP Use of regular expression ereg_replace smartly

January 11, 2007

I was working on the application and came accross a situation where I need to replace all character except the numeric ones. My text pattern was something similar to varchar(20). I initial thought to use substr, later moved to explode using “(” token. I suddenly strike is ereg_replace can help me to do this. After writing one line of code I am happy it solve the purpose.

echo ereg_replace(“[a-zA-Z()]”,””,”varchar(20)”);

[a-zA-Z()] searches for all the occurences in the string and replace them with supplied character.

I very hardly uses ereg_replace but from now onwards I will encourage myself and others to use ereg_replace.


Something you can always do at database level

January 9, 2007

I found many developers even sometimes I do some code which could be possible at the database level. Why to format date at coding level when DATE_FORMAT function is available.

Developer should be careful enough to identify the cases where they can performes operation at database level. This will help to improve the overall performance and efficiency of your application.

I will be keep adding the tips about the same in this entry

First
=====
If you want to format date by fetching it from database, you can use DATE_FORMAT function.

eg. SELECT DATE_FORMAT(now(), ‘%y’) FROM tableName


My cute little Bhanja (nephew) Kaustubh

January 3, 2007

Its about 2 years back, I took my 1 year nephew to the nearest photo studio and ask them to take some random photograph. I get back to home with the soft copies of photos, imported them and edited in Photoshop. How its looking?. He is now 3 year old and started driving mini bicycle.


My cute little Bhanja (nephew) Kaustubh