E Commerce and Web Engineering
E Commerce and Web Engineering
2. How is PHP related with HTML? PHP (Hypertext preprocessor) is a server side
Scripting language, While HTML ( Hypertext markup language) is a markup
language used for structuring and presenting Web content. PHP and HTML are
often used together to create dynamic web page. Here’s How they are related:
Integration, server side processing , separation of concerns, Dynamic content
Tempting.
3. State and briefly describe the PHP data type? PHP allows eight different types
of data types. All of them are discussed below. The first five are called simple data
types and the last three are compound data types: Integer, Double, String, Null,
Boolean, Arrays( Numeric Array, Associative Array, Multidimensional Array),
Object, Resources.
4. Define "Converting Data Type", "Variable Scope", "Global Keyword", "Static
Variables", "Constant" in PHP? Converting Data Type: Types conversion is the
change of a certain variable form one type to another. PHP automatically convert
one type to another whenever possible. For example: if we assign a string value to
variable, this variable becomes a string variable. Variable Scope: In PHP, variables
can be declared anywhere in the script. The scope of a variable is the part of the
script where the variable can be referenced/used. PHP has three different variable
scopes: local, global static. Global Keyword: Global keyword is used when we want
to read or write any global variable value inside the function. The global keyword
used for a variable declared outside the function does not have any effect on it.
Static Variables: A static variable is the attribute of PHP to erase the variable once
it finishes its execution and the memory is liberated. Constant: A constant is an
identifier (name) for a simple value. The value cannot be changed during the script.
A valid constant name starts with a letter or underscore (no $ sign before the
constant name)
5. Write down the different ways of declaring array in PHP? An array is special
variable, which can hold more than one value at time. In PHP there are three types
of array: 1.Index array-Array with a numeric index 2.Associative arrays- array with
name keys 3.Multidimesional array- Array containing one or more arrays. Indexed
Arrays: There are two ways to create indexed arrays- $cars = array("Volvo",
"BMW", "Toyota"); 2.$cars[0] = "Volvo"; $cars[1] = "BMW"; $cars[2] = "Toyota";
Associative Arrays: There are two ways to create an associative array: $age =
array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); 2.$age['Peter'] = "35";
$age['Ben'] = "37"; $age['Joe'] = "43"; Multidimensional Arrays: For a two-
dimensional array you need two indices to select an element. For a three-
dimensional array you need three indices to select an element.
6. Write down the difference types of super global variable with their
functionality? $GLOBALS is the super global variable that stores all user-defined
global variables. $_SERVER contains data about headers, scripts, and paths.
$_REQUEST stores data input in the form of HTTP POST, GET and Cookies. $_POST
stores data input in the form of POST requests. $_GET has data input in the form
of GET requests. $_FILES is a two-dimensional associative array that contains a list
of files that were uploaded to the script using the POST method. $_COOKIES keeps
data input via HTTP Cookies. $_SESSION holds session variables.
7. Write down the differences between GET and POST method? A.URL A.POST B.
Can be seen by anyone B. Doesn’t display variables in url C. Up to 2000 character
C. Up to 8 MB D. Method can be cached D. Does not cache the data
8. Explain with example use of session and cookie variable in static management?
1. Sessions are server-side files that contain user data 1.Cookies are client-side files
on a local computer that hold user information 2.When the user quits the browser
or logs out of the programmed, the session is over 2.Cookies end on the lifetime
set by the user 3.It can hold an indefinite quantity of data 3.It can only store a
certain amount of info 4.Session are more secured compare than cookies 4.Cookies
are not secured
9. Explain advantages and disadvantages of MySQL? Advantages: 1.Reduced Total
Cost of Ownership 2.Portability 3.Seamless Connectivity 4.Rapid Development and
Round-the-Clock Uptime 5.Data Security Disadvantages: 1. MySQL lower version
(5.0 or less) doesn't support ROLE, COMMIT and stored procedure. 2. MySQL does
not support a very large database size as efficiently. 3. MySQL doesn't handle
transactions very efficiently and it is prone to data corruption.
10. write down the steps of basic PHP MySQL connection with simple code. Exam-
kit
12. What is URL encoding with examples? Some characters cannot be part of a URL
(for example, the space) and some other characters have a special meaning in a
URL. In HTML forms, the character = is used to separate a name from a value. The
URI generic syntax uses URL encoding to deal with this problem, while HTML forms
make some additional substitutions rather than applying percent encoding for all
such characters. Example chat
13. What are the features that made MySQL a popular database management
system for web server? Data security , on demand scalability, High performance,
Round the Clock Uptime, comprehensive Transactional Support, Complete
workflow control, Reduced Total cost of ownership, The flexibility of open source
14. What are the techniques used for form validation and verification in PHP? An
HTML form contains various input fields such as text box, checkbox, radio buttons,
submit button, and checklist, etc. These input fields need to be validated, which
ensures that the user has entered information in all the required fields and also
validates that the information provided by the user is valid and correct. There is no
guarantee that the information provided by the user is always correct. PHP
validates the data at the server-side, which is submitted by HTML form. You need
to validate a few things: Empty String , Validate String, Validate Numbers ,Validate
Email ,Validate URL , Input length