Showing posts with label new php interview question for PHP. Show all posts
Showing posts with label new php interview question for PHP. Show all posts

Thursday, 20 March 2014

php interview question

Qsn. How to set cookies in PHP?
Ans.  Setcookie("sample", "ram", time()+3600);
in php we can use 5 parameters in setcookie and but in above e.g we used jsut 3 parameters.

Qsn. How to retrive cookies in PHP?
Ans. Echo $_COOKIE[user]";

Qsn. how to create a session in php?
Ans. the create syntax  session in php is :- SESSION_start();
and set a session value  in php :  $_session["user_id"];
Qsn. use of explode() function in php ?
Ans. Syntax of explode is :  array explode(string $delimiter , string $string[, int$limit]);
this is use for break a string into array.

Qsn. use of trim function in php?
Ans. use for remove white space and predefined character.

Qsn. how to redicect a page in php?
Ans.  Header("location:index.php"); this code is use for redirect any page;


Monday, 17 March 2014

php_interview_question

Qsn. What is the use of rand() in php language?
Ans.  rand() function in used to generate random numbers in php.Ii give a result of random no b/w given value. for e.g. If we want to random number between 0 and 10 than we use rand function.It is mostly use for make a capture in signup.

Qsn. What is the use of isset() in php?
Ans.  This function is used to determine if a variable is set and is not NULL.

Qsn.  What is mean by an associative array?
Ans.  Associative arrays are arrays that use string keys is called associative arrays.

Qsn.What is the importance of "method" attribute in a html form?
Ans.  "method" attribute determines how to send the form-data into the server.We use to type of method in php or any webdevelopment language for design a web form. they are GET and POST method.if we dont declare any type of method than it is GET by defult.

Qsn. Define Object-Oriented Methodology
Ans. Object orientation is a software/Web development methodology that is based on the modeling a real world system.An object is the core concept involved in the object orientation. An object is the copy of the real world enity.An object oriented model is a collection of objects and its inter-relationships

Friday, 28 February 2014

new_php_interview_question

Qsn 1.How do you define a constant?
Ans.Using define() directive, like define ("MYCONSTANT",150)

Qsn.2How send email using php?
Ans.To send email using PHP, you use the mail() function.This mail() function accepts 5 parameters as follows (the last 2 are optional). You need webserver, you can't send email from localhost. eg : mail($to,$subject,$message,$headers);

Qsn.3How to find current date and time?
Ans.The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional - if you don't, the current timestamp will be used.

Qsn.3Difference between mysql_connect and mysql_pconnect?
Ans.There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection... the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

Qsn.4What is the use of "ksort" in php?
Ans.It is used for sort an array by key in reverse order.