What are the different errors in PHP?
There are 4 basically types of error.
What is an associative array?
Associative arrays are arrays that use named keys that you assign to them.
What is PDO classes?
The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. It is a data-access abstraction layer, so no matter what database we use the function to issue queries and fetch data will be same. Using PDO drivers we can connect to database like DB2, Oracle, PostgreSQL etc.
What are the different types of PHP variables?
PHP has a total of eight data types which we use to construct our variables −
What are the differences between PHP constants and variables?
Explain the syntax for 'foreach' loop.
The foreach statement is used to loop through arrays. For each pass the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass next element will be processed.
foreach (array as value)
code to be executed;
How will you concatenate two strings in PHP?
To concatenate two string variables together, use the dot (.) operator −
echo $string1 . " " . $string2;
This will produce following result −
Hello World 1234
How will you generate random numbers using PHP?
The PHP rand() function is used to generate a random number. This function can generate numbers with-in a given range. The random number generator should be seeded to prevent a regular pattern of numbers being generated.
What is the purpse $_REQUEST variable?.
The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE. We will discuss $_COOKIE variable when we will explain about cookies. The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.