So I suspected this must be something to do with server settings. I differentiate my local phpinfo with the server phpinfo.
It's magic_quotes_sybase is on at the server but off in my locals. I already ask my admin to off the magic_quotes_sybase. Later I will reply with the results.
Why do I think that is the problem? Based on the php manuals:
Note: If the directive magic_quotes_sybase is ON it will completely override magic_quotes_gpc. So even when get_magic_quotes_gpc() returns TRUE neither double quotes, backslashes or NUL's will be escaped. Only single quotes will be escaped. In this case they'll look like: ''
So If magic_quotes_sybase is on, a single-quote is escaped with a single-quote instead of a backslash
I hope this info will benefits others.