Thursday 26 April 2012

PHP Interview question 5


6) What are the differences between Get and post methods.
Ans :   There are some defference between GET and POST method
1. GET Method have some limit like only 2Kb data able to send for request
But in POST method unlimited data can we send
2. when we use GET method requested data show in url but
Not in POST method so POST method is good for send sensetive request
                 
7)  How can we extract string "pcds.co.in " from a string "http://info@pcds.co.in using regular expression of PHP?
Ans: preg_match("/^http:\/\/.+@(.+)$/","http://info@pcds.co.in",$matches);
echo $matches[1];
                 
8)  How can we create a database using PHP and MySQL?
Ans :  We can create MySQL database with the use of mysql_create_db("Database Name")
                 
9) What are the differences between require and include?
Ans : Both include and require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error .
             
10) Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"?
Ans : Yes we can use include("xyz.php") more than one time in any page. but it create a prob when xyz.php file contain some funtions declaration then error will come for already declared function in this file else not a prob like if you want to show same content two time in page then must incude it two time not a prob

No comments:

Post a Comment