There are four kinds of PHP statements that are present. They are as follows:
• Simple statement- these are the echo statements and end with a semicolon (;). PHP ignores white spaces between simple statements. Until it finds a semicolon it reads the statement.
• Complex/Conditional statements: these are the statements which deal with certain conditions that have to be executed to meet certain specific requirements. These are if and else block or switch statements. PHP reads the complete statement and doesn’t stop at the first semicolon it encounters. It looks for starting and ending braces to end the execution.
• Looping statements: statements that are repeated in a block. The feature that enables you to execute the statements repeatedly is called as loop. For example: for loop, while loop, do..while loop.
Monthly Archives: June 2015
What is difference between require_once(), require(), include()?
require() includes and evaluates a specific file, if the file is not found then it shows a Fatal Error.
require_once() includes only the file which is not being included before. It is used to be recommended for the files where you have lots of functions stored.
include() includes the file, even if the file is not found, but it gives a warning to the user to include().
Why PHP is sometimes called as embedded scripting language?
PHP is a high level language which is used to allow users to write and understand it in human readable form and also use an interpreter to interpret the code which user write for the computer. PHP is used as an embedded scripting language for the web. PHP is embedded in HTML code. HTML tags are used to enclose the PHP language. HTML is used and PHP is code written in it in the same way as you write JavaScript in HTML.
What does ODBC do in context with PHP?
PHP supports many databases like dBase, Microsft SQL Server, Oracle, etc. But, it also supports databases like filePro, FrontBase and InterBase with ODBC connectivity. ODBC stands for Open Database connectivity, which is a standard that allows user to communicate with other databases like Access and IBM DB2.
What are the different types of Errors in PHP?
There are three basic types of runtime errors in PHP:
1. Notices: These are small, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although the default behavior can be changed.
2. Warnings: Warnings are more severe errors like attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.
What is MIME?
MIME – Multi-purpose Internet Mail Extensions.
MIME types represents a standard way of classifying file types over Internet.
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.
A MIME type has two parts: a type and a subtype. They are separated by a slash (/).
MIME type for Microsoft Word files is application and the subtype is msword, i.e. application/msword.
What is the purpose of $_SESSION[]?
Used to store variables of the current session.
The purpose of the function $_SESSION[] is to store data that you would like to preserve across page loads and to store variables of current session.
In mysql_fetch_array() If two or more columns of the result have the same field names, what action is taken?
The mysql_fetch_array() function returns a row from a recordset as an associative array and a numeric array.
If two or more columns of the result have the same field names,then the last column will take precedence.
What is x+ mode in fopen() used for?
Read/Write. Creates a new file. Returns FALSE and an error if file already exists
What is the default execution time set in set_time_limit() PHP
The default execution time set in set_time_limit() function is 30 secs.
This function restarts the timer counter form zero and when the number of seconds a script is allowed to run is reached, it returns a fatal error.