Php and mysql interview questions online

Online php and mysql interview Questions with answers-- Asked at different competitive exams

Free Online test your knowledge on php and mysql programming exams. Each questions immediate answer or explanation given below, just click View answer button and also have option of Hide Answer button to hide answer. In this given upto 100+ questions and shows answer or explanation under of each question.
          Here all the questions and answers, most asked in different competitive exams and shows answers accordingly.
php and mysql interview questions with answers
Q81. WHAT TYPES OF IMAGES THAT PHP SUPPORTS?

Answer: Using imagetypes() function to find out what types of images are supported in your PHP engine.
imagetypes() – Returns the image types supported.
This function returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP.
The following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM.

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

Answer: session_id() returns the session id for the current session.

Q83.How can we destroy the cookie?

Answer: Set the cookie with a past expiration time.

Q84. What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?

Answer: All of those are open source resource. Security of linux is very very more than windows.
Apache is a better server that IIS both in functionality and security. Mysql is world most popular open source database. Php is more faster that asp or any other scripting language.

Q85. What is the use of friend function?

Answer: Friend functions
Sometimes a function is best shared among a number of different classes. Such functionscan be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class.
A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match.
class mylinkage
{
private:
mylinkage * prev;
mylinkage * next;
protected:
friend void set_prev(mylinkage* L, mylinkage* N);
void set_next(mylinkage* L);
public:
mylinkage * succ();
mylinkage * pred();
mylinkage();
};
void mylinkage::set_next(mylinkage* L) { next = L; }
void set_prev(mylinkage * L, mylinkage * N ) { N->prev = L; }
Friends in other classes
It is possible to specify a member function of another class as a friend as follows:
class C
{
friend int B::f1();
};
class B
{
int f1();
};
It is also possible to specify all the functions in another class as friends, by specifying the entire class as a friend.
class A
{
friend class B;
};
Friend functions allow binary operators to be defined which combine private data in a pair of objects. This is particularly powerful when using the operator overloading features of C++. We will return to it when we look at overloading.

Q86.How can we get second of the current time using date function?

Answer: $second = date(“s”);

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

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

Q88. How can I make a script that can be bilingual (supports English, German)?

Answer: You can change charset variable in above line in the script to support bilanguage.

Q89. How many ways I can redirect a PHP page?

Answer:
Here are the possible ways of php page redirection.
1. Using Java script:
‘; echo ‘window.location.href=”‘.$filename.'”;’; echo ”; echo ”; echo ”; echo ”; } }
redirect(‘http://maosjb.com’); ?>
2. Using php function:
header(“Location:http://bestvwant.org “);

Q90. What type of headers have to be added in the mail function to attach a file?

Answer:
$boundary = ‘–‘ . md5( uniqid ( rand() ) );
$headers = “From: \”Me\”\n”;
$headers .= “MIME-Version: 1.0\n”;
$headers .= “Content-Type: multipart/mixed; boundary=\”$boundary\””;

More pages : Php Interview Questions

0 Comments:

Post a Comment