Friday, February 20, 2009

What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?

When we submit a form, which has the GET method it displays pair of name/value used in the form at the address bar of the browser preceded by url. Post method doesn’t display these values.

How can we extract string ‘abc.com ‘ from a string ‘http://info@abc.com’ using regular _expression of php?

preg_match(”/^(http:\/\/info@)?([^\/]+)/i”,”http://info@abc.com”, $data);
echo $data[2];

What are the differences between require and include, include_once?

File will not be included more than once.
If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.

How can we create a database using php and mysql?

mysql_create_db().

Can we use include (”abc.php”) two times in a php page “makeit.php”?

Yes we can include..

What are the different types of errors in PHP?

Three are three types of errors :
1) Fatal errors
2) Parser errors
3) Startup errors

What is the functionality of the function strstr and stristr?

string strstr ( string str1, string str2) this function search the string str1 for the first occurrence of the string str2 and returns the part of the string str1 from the first occurrence of the string str2. This function is case-sensitive and for case-insensitive search use stristr() function.