Sunday, 15 June 2014

var_dump_in_php

why we use var_dump() in php

<?php
$var1= hello;
 var_dump($var1); // show the string  data tyoe
echo "</br>";
$var2=20;
var_dump($var2); // show the integer data type
echo "</br>"
$var3=20.4;
var_dump($var3); // show the float data type
?>

var_dump() function is mainly use for check or show the data type  in php and it print the data type in outupt screen

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.

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".