61.  

What are the correct and the most two common way to start and finish a PHP block of code?

The two most  common ways to start and finish a PHP script are:

Example:

 


    


    

[ --PHP code--]


    

?>


    

and


        


    

[ --PHP code--]


    

?>

 

 

 

62.  

What does the initials of PHP stand for?

PHP means PHP: Hypertext Preprocessor.

63.  

What is the main difference between require() and require_once()?.

require() and require_once() perform the same task except that the second function checks if the PHP script is already included or not before executing it.
(same for include_once() and include()).

64.  

What does the PHP error ‘Parse error in PHP – unexpected T_variable at line x’ means?

This is a PHP syntax error expressing that a mistake at the line x stops parsing and executing the program.

65.  

How can we connect to a MySQL database from a PHP script?.

To be able to connect to a MySQL database, we must use mysql_connect() function as follows:

Example:

database = mysql_connect("HOST", "USER_NAME", "PASSWORD"); mysql_select_db("DATABASE_NAME",$database);

66.  

How can we check the value of a given variable is a number?

We can check any variable by using is_numeric() whether it is a number or not.

67.  

What does the unlink() function means?

The unlink() function is used to deleting the files from server.

68.  

What does the unset() function means?
 

The unset() function is used to unset any variable. It will make a variable undefined.

69.  

How a constant is defined in a PHP script?

The define() is used to efining a constant as follows:

Example:

define (“ACONSTANT”, 123);

70.  

How is the ternary conditional operator used in PHP?

It is composed of three expressions: a condition, and two operands describing what instruction should be performed when the specified condition is true or false as follows:

Example:

Expression_1 ? Expression_2 : Expression_3;
 

71.  

what is the definition of a session?

A session allow us to preserve temporary data across multiple PHP pages.
 

72.  

What is the difference between session_unregister() and session_unset()?

The session_unregister() function unregister a global variable from the current session and the session_unset() function free all session variables.

73.  

What is the difference between $_FILES[‘userfile’][‘name’] and $_FILES[‘userfile’][‘tmp_name’]?

$_FILES[‘userfile’][‘name’] represents the original name of the file on the client machine,
$_FILES[‘userfile’][‘tmp_name’] represents the temporary filename of the file stored on the server.

74.  

What is the default session time in php?

Typically the default is 24 minutes (1440 seconds).

75.  

Who is the father of PHP ?

Rasmus Lerdorf is known as the father of PHP.
 

76.  

What are the method available in form submitting?

GET and POST.

77.  

How to store the uploaded file to the final location?

move_uploaded_file( string filename, string destination).

78.  

What are the differences between Get and post methods.

There are some defference between GET and POST method

Example:
  •  GET Method have some limit like only 2Kb data able to send for request

But in POST method unlimited data can we send.

  •  when we use GET method requested data show in url but

Not in POST method so POST method is good for send sensetive request.

79.  

What is use of header() function in php ?

The header() function sends a raw HTTP header to a client.We can use herder()
function for redirection of pages. It is important to notice that header() must
be called before any actual output is seen.
 

80.  

How can we find the number of rows in a result set using PHP?

$result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";