PHP Interview Questions for freshers 05
What is meant by urlencode and urldocode?
Urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(“10.00%”) will return “10%2E00%25?. URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.
What is the difference between the functions unlink and unset?
Unlink() deletes the given file from the file system.
unset() makes a variable undefined.
How can we register the variables into a session?
We can use the session_register ($ur_session_var) function.
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
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.
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.
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”;
How many ways can we get the value of current session id?
session_id() function returns the session id for the current session.
How can we destroy the session, how can we unset the variable of a session?
session_destroy and session_unset