php

PHP Local Date

Thursday, November 6th, 2008 | Programming | Comments Off

Using date and time functions in PHP is as easy as it gets. However there are times when the website you build is addressed to a non-English audience, let’s say Greek.

We know that date(“F”) will echo “January” if we are in January and so on. So what if we wanted to echo the current month in Greek (January = Ιανουάριος)?

The following code snipped will say everything it needs to:
setlocale(LC_TIME, ‘greek’);
echo strftime(“%B”); //Ιανουάριος

Note: On some windows systems the above code won’t work so you may want to try:
setlocale(LC_CTYPE, ‘greek’);
setlocale(LC_TIME, ‘greek’);
echo strftime(“%B”); //Ιανουάριος

Tags: , ,

PHP & Oracle – Singapore Meeting

Friday, October 31st, 2008 | Programming | Comments Off

I recently invested some of my time to watch the PHP & Oracle presentation video from the meeting which took place this month in Singapore:

If you are in the PHP business it really worth considering porting your database to Oracle 10gR2 or 11g and using oci8 as oracle datasource for your application.

Just some of the performance features you will get:
-prefetching rows (reducing round trips from web to database servers)
guidelines to follow when prefetching rows:
* don’t prefetch more data than necessary
* use SQL to process data especially analytics functions

-binding scalars
(avoiding double parsing SQL statements like SELECT * FROM USERS WHERE user_id=2 and SELECT * FROM USERS WHERE user_id=3)
A great advantage is that avoids SQL injections too!

-transactions

-PL/SQL

-array binds

-statement cache

Tags: ,