Friday, November 19, 2010

What are the database space-saving functions available in php ?

# Use ip2long() and long2ip() to store the IP adresses as Integers instead
of storing them as strings, which will reduce the space from 15 bytes to 4
bytes. This will also increase search speed and make it easy to see if a ip
falls within a specified range.

# Use gzcompress() and gzuncompress() to reduce the strings before you
store them in a database. The gzcompress can compress plain-text up to 90%.
The only reason why you shouldn’t use it is when you need full-text
indexing capabilities.

How can we save an image from a remote web server to my web server using PHP?

$file_rimg = fopen("http://w3answers /image23.jpg",'rb');
$newfile_name_img = "/tmp/tutorial.file";
$file_wnew = fopen($newfile_name_img,'wb');
while (!feof($file_rimg)) {
$chunk_rd = fread($file_rimg,1024);

Is Single Quotes better then double quotes

By using single quotes instead of double quotes, we save PHP from having
to parse your string for variables. It's not only is faster, but I find it
more programmer-friendly because it is easier to find variables in your
Also, when referencing an array that has a string index, always use single
quotes. This prevents PHP from having to figure out exactly what you were
trying to say.

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off