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.

Thursday, 6 February 2014

php_interview_question_answer

Q. What is PEAR in PHP?
Ans .PEAR stands for PHP Extension and Application Repository. PEAR is provide command-line interface that is  used for  automatically install "packages".  It is a framework and for reusable PHP components. PEAR is a code repository containing all kinds of PHP code snippets and libraries.


Q.What is MIME in PHP?
Ans.MIME stands for Multi-purpose Internet Mail Extensions.It represents a standard way of classifying file types over Internet.A MIME type has two parts:
_A type
_A subtype
They are separated by a slash (/). Web servers and browsers have a list of MIME types, which facilitates files transfer of the same type in the same way, irrespective of operating system they are working in.

Q.What is the Fatal errors in PHP?
Ans.Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.

Wednesday, 5 February 2014

Which language is Best for Programming?

Which language is Best for  Programming?

Ans. 1st of all no programing language is best it's depend on the programmer and which language is used by us.But i thing php is best to other language because it is very easy to use and very popular also.75% of websites are developed in php. PHP is used by many big and popular website such as Facebook, yahoo,Digg etc. and many small website.and scope in php is also good. today it is better option of carrier.

if else condition

If-else condition program in php
<?php
$a=10;
if($a=10)
{
echo "this is true";
}
else
{
echo"this is false";
}
?>

o/p= this is true


we take a variable  "a" and it's value is 10.
in php we define variable with '$'
after this we define apply if condition . if a = 10 then it print "this is true"
otherwise it print "this is false".
 

switch case in php



2.program Switch case in php

<?php
$day="sun";
switch ($day)
{
case "sun":
 echo "today is Sunday";
 break;
case "Monday":
echo "today is Monday";
break;
case "Tuesday":
echo "today is Tuesday";
break;
case "Wednesday":
echo "today is Wednesday";
break;
default:
echo "today is ?";
}
?>

Tuesday, 4 February 2014

1st program in php

simple and 1st program of php:-

<?php
echo "this is my first program.;"
>

o/p= this is my first program.


here  "echo " keyword is used for print the data.
we start php with "<php " and end with ">"

what is php.



PHP stands for hyper text preprocessor language and this is used for only web based application  means online for web development and PHP is a server-side scripting language but also used as a general-purpose programming language. PHP is now installed on more than 2440000000 websites and 2.1 million web servers also on internet.PHP is invented by  Rasmus Lerdorf in 1995.Server-Side Scripting Language means that is run on server. The server may b local host or on the world wide web.php is used with CSS and html tags.PHP is open source software released under the PHP License. Here open source means it is free for all. The cost of PHP software is noting