php

php-rar extension on Ubuntu

Just a very quick post for new comers to Ubuntu who is looking for a way to install rar extension. RAR extension (should be php5-rar) is not available on Ubuntu official, apt-get install php5-rar won't work, not sure why. If you want to install it then you can use PECL from PEAR instead, as following:

$ sudo apt-get install php5-dev php-pear g++
$ sudo pecl install rar

Category:

Calculating string height for TCPDF library

I'm working with TCPDF to generate a PDF report, and the task looks like a nightmare. It's because TCPDF is missing some method to help you calculating the height of a string. There is a solution here , but it won't work for me. I have to spend the whole day to find out the problem and the solution seems to be very simple.

Category:

Tags:

Improve PHP file loading

I think you have already known that require/include is faster than require_once/include_one. But sometime, we also need the functionality of require_once but do not suffer from the performance tradeoff. So here is a better way to re-invent PHP implement.

function requireOnce($file)
{
static $dict=array();

if (!isset($dict[$file]))
{
require $file;
$dict[$file] = true;
}
}

Category:

The best way to access PHP global variable

I have been playing with PHP minor optimization for a while, but this is the first time I go for it seriously. My question for today is what's the best way to work with PHP global variables and how to achieve best performance for it. Rumours say that global keyword is slow, so this is a good time to check it out. And I also want to check if the number of variables affects the performance of the method.

Setup

Category:

The easy way to get GMail contact list

If you're looking for a solution to get contact list / address book in Gmail, you're in the right place. I was looking for the solution too. Actually, I also want to grab contact list from other popular service such as Live, Yahoo! Mail, etc ... but I started with Gmail first. The requirement is simple: the user provides email and password, the application will perform some requests to google and return the contact list.

Category:

Pages

Subscribe to RSS - php