Wednesday, January 6, 2010

PHP: light class to work with SQLite

Today I share with you, simple and lightweight class to connect to SQLite database. This is very usefull if you don't want import large adodb library or similar. If you need just make few database queries, this solution are for you.

Friday, January 1, 2010

PHP: convert php array to javascript array

sometimes need convert php array to javascript array. If your hosting service meet these requirements (PHP 5 >= 5.2.0, PECL json >= 1.2.0). You can do this with json_encode function



If you don't have json_encode function, you can use this function.

Wednesday, December 30, 2009

PHP: date functions usage

PHP have two families of date functions.
date(), time(), mktime() functions calculate time in current server time zone. These functions complicated, when need compare time in different time zones. For this kind task php have gmtime() gmdate() gmmktime() functions, these functions return Greenwich Mean Time, which are same in all world and ignore current server time zone.

You can change time zone with date_default_timezone_set function. Supported time zones list you can find here

PHP: simple but powerful file upload class

Today I share with you idea how handle uploading files. First you need html form, with proper enctype.



Then download FileUpload class from my github repository.
Create upload.php file.



File will be uploaded to uploads directory (must be writeable).

PHP: how validate email

Regexp to validate email
First example validate only email syntax, second check if DNS MX record exists.

Tuesday, December 29, 2009

PHP: watermarks

Maybe you have trouble to put png watermark on jpeg image? I share with you simple solution. You can found it on my github repository . Git is very good solution for code managment. But about it I tell you later.

How to check whick php version you are running

phpinfo() function will print nice table, where you can see all php settings. Also this function usefull when need check installed extensions.


 
Software