Monday 9 February 2015

PHP Developer Interview Questions and Answers (Page 9)

Below are some important PHP interview questions which are asked in most MNC company interviews for beginners or professionals.

81.How can we get the properties (size, type, width, height) of an image using php image functions?
To know the image size use getimagesize() function
To know the image width use imagesx() function
To know the image height use imagesy() function

82. How to set cookies?
setcookie(‘variable’,'value’,'time’);
variable – name of the cookie variable
value – value of the cookie variable
time – expiry time
Example: setcookie(‘Test’,$i,time()+3600);
Test – cookie variable name
$i – value of the variable ‘Test’
time()+3600 – denotes that the cookie will expire after an one hourHow to reset/destroy a cookie ?
Reset a cookie by specifying expire time in the past:
Example: setcookie(‘Test’,$i,time()-3600); // already expired time
Reset a cookie by specifying its name only
Example: setcookie(‘Test’);

83.What types of images that PHP supports ?
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.

84.Check if a variable is an integer in JAVASCRIPT ?
var myValue =9.8;
if(parseInt(myValue)== myValue)
alert(‘Integer’);
else
alert(‘Not an integer’);

85.Tools used for drawing ER diagrams.
Case Studio
Smart Draw

86.How can I know that a variable is a number or not using a JavaScript?
bool is_numeric( mixed var)
Returns TRUE if var is a number or a numeric string, FALSE otherwise.

87.How can we submit from without a submit button?
Trigger the JavaScript code on any event ( like onSelect of drop down list box, onfocus, etc )
document.myform.submit(); This will submit the form.

88.How many ways can we get the value of current session id?
session_id() returns the session id for the current session.How can we destroy the cookie?
Set the cookie with a past expiration time.

89.What are the current versions of Apache, PHP, and MySQL?
PHP: PHP 5.2.5
MySQL: MySQL 5.1
Apache: Apache 2.1

90.What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?
All of those are open source resource. Security of Linux is 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.
More Questions & Answers :-
Page1  Page2  Page3  Page4  Page5  Page6  
Page7  Page8  Page9  Page10

No comments:

Post a Comment