php interview ques

Upload: prashant-raj

Post on 08-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Php Interview Ques

    1/7

    What is the difference between print and echo commands?Latest Answer: echo is the most primitive of them, and just outputs the contents following theconstruct to the screen. print is also a construct (so parentheses are optional when calling it), butit returns TRUE on successful output and FALSE if it was unable ...Read Answers (1) | Asked by : Gaurav23

    Protecting folder with Htaccesshow can I protect my folders and file using htaccess file?Latest Answer: This requires two files1. .htaccess2. .htpasswdplace these two files in yourfolder, which you want to protect.contents in .httaccess---------------------------------------------------AuthType BasicAuthName "protected folder"AuthUserFile ...Read Answers (1) | Asked by : akrmasl

    Functionality of trim() FunctionWill the trim() function strip the NULL bytes?Latest Answer: The trim function trims whitespace characters. IE space, tab, etc.NULL means

    that nothing exists. Therefore, the answer to your question is no. Trim does not strip NULL. ...Read Answers (4) | Asked by : tallman07

    Abstract Class and Final MethodWhich of the following is correct in case of abstract class..(1) An abstract class can not have finalmethod(2) An abstract class can not have non-abstract method(3) A final class can not haveabstractLatest Answer: (3) A finalized class cannot have an abstract method.This makes sense becauseonce a class is finalized nothing in that class can be overwritten. ...Read Answers (1) | Asked by : tallman07

    Hide Pages Written in PHPHow can we hide the fact that the web pages are written in PHP?Latest Answer: I believe you can do this using the RewriteRule in the .htaccess file ...Read Answers (3) | Asked by : tallman07

    High Precedence

    Which one has the high precedence between && and and?Latest Answer: && is the highest precedence than and ...

    Session Cache ExpireIf sesio_cache_expire is not set than in how much time will it expire? a. 1 hour,b. 2 hours,c. 3hours,d. 4 hoursLatest Answer: c. 3 hours ...Read Answers (2) | Asked by : tallman07

  • 8/6/2019 Php Interview Ques

    2/7

    Feof with fsockopenWhile working with file system, can feof be used with a file open by fsockopen?Latest Answer: fsockopen() returns a file pointer which may be used together with the other filefunctions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will returnFALSESo feof can be used with a file open by fsockopen. ...Read Answers (1) | Asked by : tallman07

    Array ComparisonWhile comparing two array what is the difference between === and ==?Latest Answer: == operator check the value is equal or not=== will check both value and its datatype ...Read Answers (2) | Asked by : tallman07

    CurlWhat is curl? What is the functionality of curl?Latest Answer: cURL is a library which allows you to connect and communicate to many differenttypes of servers with many different types of protocols. Using cURL you can: Implement paymentgateways payment notification scripts.Download and upload files from ...Read Answers (2) | Asked by : tallman07

    Cron JobsWhat are cron jobs? Explain in details.Latest Answer: Its self run program in UNIX, LINUX any commands can be executed.. base on

    data and time.Eg : to shutdown your server system when clock lock's 9. 00 PM ...Read Answers (2) | Asked by : tallman07

    Enctype in FormWhy do we use enctype in form while uploading a file?Latest Answer: The enctype attribute specifies how form-data should be encoded before sendingit to the server.The form-data is encoded to "application/x-www-form-urlencoded" by default. Thismeans that all characters are encoded before they are sent to the server (spaces ...Read Answers (2) | Asked by : mukulb22

    CurlWhat is curl? What is the functionality of curl?Latest Answer: cURL is a library which allows you to connect and communicate to many differenttypes of servers with many different types of protocols. Using cURL you can: Implement paymentgateways payment notification scripts.Download and upload files from ...Read Answers (2) | Asked by : tallman07

  • 8/6/2019 Php Interview Ques

    3/7

    Cron JobsWhat are cron jobs? Explain in details.Latest Answer: Its self run program in UNIX, LINUX any commands can be executed.. base ondata and time.Eg : to shutdown your server system when clock lock's 9. 00 PM ...Read Answers (2) | Asked by : tallman07

    Enctype in FormWhy do we use enctype in form while uploading a file?Latest Answer: The enctype attribute specifies how form-data should be encoded before sendingit to the server.The form-data is encoded to "application/x-www-form-urlencoded" by default. Thismeans that all characters are encoded before they are sent to the server (spaces ...Read Answers (2) | Asked by : mukulb22

    Sponsored Links@ symbol before any variableWhy do we put @ symbol before any variable?Latest Answer: Actually it is called as the 'supression operator'.It is specially used toavoid/supress the display of warnings that function can generate.It increases the executiontime. ...Read Answers (6) | Asked by : tallman010

    Ob_start()What is the use of ob_start() in PHP?Latest Answer: Turn on Output Buffering.While output buffering is active no output is sent fromthe script (other than headers), instead the output is stored in an internal buffer. Let's considerfollowing example:Read Answers (5) | Asked by : raghaven

    Store Image in MySQLHow to store image in MySQL database via PHP?Latest Answer: $iname=$_FILES['img1']['name']; $fp=fopen($_FILES['img1']['tmp_name'],r);

    $con=fread($fp,filesize($_FILES['img1']['tmp_name'])); ...Read Answers (3) | Asked by : kirangona

    Calculate Date DifferenceHow will you calculate difference of two dates using PHP?Latest Answer: // Calculate difference and returns the difference in days.functionbozimsDateDiff($date1, $date2){ return floor(($date2 - $date1) / (3600 * 24));}// Usage$date2 =

  • 8/6/2019 Php Interview Ques

    4/7

    time(); // e,g Date 2 CURRENT DATE TIMESTAMP$date1 = mktime(0,0,0,1,17,1988); // e,g ...

    Increase Execution TimeHow will you increase execution time of PHP for processing large set of records?Latest Answer: set_time_limit() function will limits the maximum execution time.When called,set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) ...Read Answers (4) | Asked by : rubin2008

    ArraysHow to combine 2 arrays?Latest Answer: Arrays can be combined using array_merge() function Description of array_mergefunction is as follows.array_merge() merges the elements of one or more arrays together so thatthe values of one are appended to the end of the previous one. It returns the ...Read Answers (6) | Asked by : kirupa lakshmi

    Set JavaScript Variable ValueCan you set JavaScript variable value to php variable? Justify your answer?Latest Answer: php code example:$i=5; echo "var x=$i; alert(x);"; ...Read Answers (5) | Asked by : pratibhapatel

    Echo and PrintWhat is the difference between "echo" and "print" in PHP?Latest Answer: echo is the most primitive of them and just outputs the contents following the

    construct to the screen.print is also a construct (so parentheses are optional when calling it) but itreturns TRUE on successful output andFALSE if ...Read Answers (5) | Asked by : stan555ley

    POST and GET MethodsWhich will execute faster POST or GET? ExplainLatest Answer: Yes, the basic difference in between GET and POST is - all data sent to theserver in GET method is displayed in address bar and it usefull in small scale app.In POSTmethod, data can be more than 255 charecters and is used to send ...Read Answers (7) | Asked by : raghuveerpm

    PHP Form HijackingHow to prevent form hijacking in PHP?Latest Answer: To prevent form hijacking(1) Escape data which is being passed into sql queryusing mysql_real_escape_string() function.(2) Also input data must be filtered before beingpassed into sql query using proper validation methods and use of htmlentities() function ...Read Answers (3) | Asked by : sanjay.nayal

  • 8/6/2019 Php Interview Ques

    5/7

    Session_register and $_sessionWhat is the difference between session_register and $_session?Latest Answer: session_register is php function used to register variables with the currentsession.But it will work only when register globals is turned on in php.ini configuration file.$_SESSION is a superglobal array variable used for storing variables ...Read Answers (5) | Asked by : krr_r25

    PHP5 New FeaturesWhat are new features that are in added in PHP5?Latest Answer: PHP5----Strong OOPS support 1) Data Encapsulation (public, private, protectvisibility for member variables and methods) 2) Concepts like Abstraction, Inheritance,Reflections(reverse engineering APIs) 3) More Magic Functions like __construct, ...Read Answers (3) | Asked by : krr_r25

    Percentage Bar for ProcessingWhile in case of download, How will you make a percentage bar showing current status of total100%?Latest Answer: You can also use jquery instead...please visit the followinglink:http://docs.jquery.com/UI/Progressbar ...Read Answers (3) | Asked by : ravikumar.drk

    MySQL Query OptimizeWhat are the different methods to optimize the MySQL query?Latest Answer: It does not depend upon single entity. In order to optimize it you can look intofollowing things. - Make sure table has primary key. - If there is any field which is used morefrequently for searching then index it!. - The order of condition does ...Read Answers (1) | Asked by : nagaphp_indore

    Echo and PrintWhat is the difference between "echo" and "print" in PHP?Latest Answer: echo is the most primitive of them and just outputs the contents following theconstruct to the screen.print is also a construct (so parentheses are optional when calling it) but it

    returns TRUE on successful output andFALSE if ...Read Answers (5) | Asked by : stan555ley

    POST and GET MethodsWhich will execute faster POST or GET? ExplainLatest Answer: Yes, the basic difference in between GET and POST is - all data sent to theserver in GET method is displayed in address bar and it usefull in small scale app.In POST

  • 8/6/2019 Php Interview Ques

    6/7

    method, data can be more than 255 charecters and is used to send ...Read Answers (7) | Asked by : raghuveerpm

    PHP Form HijackingHow to prevent form hijacking in PHP?Latest Answer: To prevent form hijacking(1) Escape data which is being passed into sql queryusing mysql_real_escape_string() function.(2) Also input data must be filtered before beingpassed into sql query using proper validation methods and use of htmlentities() function ...Read Answers (3) | Asked by : sanjay.nayal

    Sponsored LinksSession_register and $_sessionWhat is the difference between session_register and $_session?Latest Answer: session_register is php function used to register variables with the current

    session.But it will work only when register globals is turned on in php.ini configuration file.$_SESSION is a superglobal array variable used for storing variables ...Read Answers (5) | Asked by : krr_r25

    PHP5 New FeaturesWhat are new features that are in added in PHP5?Latest Answer: PHP5----Strong OOPS support 1) Data Encapsulation (public, private, protectvisibility for member variables and methods) 2) Concepts like Abstraction, Inheritance,Reflections(reverse engineering APIs) 3) More Magic Functions like __construct, ...Read Answers (3) | Asked by : krr_r25

    Percentage Bar for ProcessingWhile in case of download, How will you make a percentage bar showing current status of total100%?Latest Answer: You can also use jquery instead...please visit the followinglink:http://docs.jquery.com/UI/Progressbar ...Read Answers (3) | Asked by : ravikumar.drk

    MySQL Query OptimizeWhat are the different methods to optimize the MySQL query?Latest Answer: It does not depend upon single entity. In order to optimize it you can look intofollowing things. - Make sure table has primary key. - If there is any field which is used morefrequently for searching then index it!. - The order of condition does ...Read Answers (1) | Asked by : nagaphp_indore

  • 8/6/2019 Php Interview Ques

    7/7

    Sponsored LinksDatabase Connectivity in JoomlaHow will you connect to the Database using Joomla?Latest Answer: Connection can be made to database in joomla by specifying database parameterinformation such as host,mysqlusername and mysql password into configuration file of joomla ...Read Answers (3) | Asked by : rahul.anand77

    Calling C FunctionHow to call a C function within PHP?Latest Answer: This is not strictly true.PHP has many native functions that have the same nameas C functions, and which act in similar ways, but they are not C functions, they are PHPfunctions. ...Read Answers (2) | Asked by : tonmoytewary

    Ob_start()What is the purpose of ob_start() ?Latest Answer: This function will redirect the output to a buffer. We can flush out the bufferob_end_flush(). ob_start must be called before any output is made. so the apt place isimmediately after opening the php tag. ...Read Answers (2) | Asked by : shaju2009