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:
[ --PHP code--]
[ --PHP code--]
What does the initials of PHP stand for?
PHP means PHP: Hypertext Preprocessor.
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()).
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.
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:
database = mysql_connect("HOST", "USER_NAME", "PASSWORD"); mysql_select_db("DATABASE_NAME",$database);
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.
What does the unlink() function means?
The unlink() function is used to deleting the files from server.
What does the unset() function means?
The unset() function is used to unset any variable. It will make a variable undefined.
How a constant is defined in a PHP script?
The define() is used to efining a constant as follows:
define (“ACONSTANT”, 123);
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:
Expression_1 ? Expression_2 : Expression_3;
what is the definition of a session?
A session allow us to preserve temporary data across multiple PHP pages.
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.
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.
What is the default session time in php?
Typically the default is 24 minutes (1440 seconds).
Who is the father of PHP ?
Rasmus Lerdorf is known as the father of PHP.
What are the method available in form submitting?
GET and POST.
How to store the uploaded file to the final location?
move_uploaded_file( string filename, string destination).
What are the differences between Get and post methods.
There are some defference between GET and POST method
But in POST method unlimited data can we send.
Not in POST method so POST method is good for send sensetive request.
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.
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";