Monday, 14 April 2014

PHP Interview Questions

How to prevent web browser to image caching?       

The simple way to prevent image caching is to append time stamp with the name on image.
Ex- <img src=’image.jpg?<?php echo time() ?>’ />

What is the difference between Primary Key and Unique key?    

Both Primary Key and Unique Key enforces uniqueness of the column on which they are defined. But by default Primary Key creates a Clustered Index on the column, where are Unique Key creates a Non clustered Index by default. Another major difference is that, Primary Key doesn’t allow Nulls, but Unique Key allows one NULL only.

What is the difference between $name and $$name?

$name is variable where as $$name is reference variable
like $name=Sadiq and $$name=Akhtar so $Sadiq value is Akhtar.

What’s the difference between md5(), crc32() and sha1() crypto on PHP?        

The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit md5() returns a 160 bit value. This is important when avoiding collisions.

No comments:

Post a Comment