PHP Interview Question and Answer for Experience

PHP : 2+ Year Experience Interview Question and Answer


19.) How can we register the variables into a session?

We can use the session_register ($ur_session_var) function.

20.) How can we get the properties (size, type, width, height) of an image using php image functions?

To know the Image type use exif_imagetype () function
To know the Image size use getimagesize () function
To know the image width use imagesx () function
To know the image height use imagesy() function

21.) What is the maximum size of a file that can be uploaded using php and how can we change this?

You can change maximum size of a file set upload_max_filesize variable in php.ini file.

22.) How can we increase the execution time of a php script?

Set max_execution_time variable in php.ini file to your desired time in second.

23.) How can we take a backup of a mysql table and how can we restore it.?

Create a full backup of your database: shell> mysqldump tab=/path/to/some/diropt db_name Or: shell> mysqlhotcopy db_name /path/to/some/dir The full backup file is just a set of SQL statements, so restoring it is very easy:

shell> mysql "."Executed";
mysql_close($link2);

24.) How many ways can we get the value of current session id?

session_id() function returns the session id for the current session.


1 2 3 4 5 6 7 8