PHP Unit 1 !!
|1. Introduction to PHP
PHP is one of the most popular language in the world of web development. It has the best connectivity with database and an expert language in insertion, deletion , updation and extraction of data from database.
It is referred as back end language. It just displays the value from the database in case of front end. As the name implies it is preprocessor. It actually refers to compilation or reading of codes before actual execution. There are various framework which php runs as Macromedia Dreamweaver, Brackets, Notepad Plus plus and many other. Any local server works perfect for PHP like wamp, xxamp, mamp .
PHP makes a website dynamic. That refers to all the things that you see on web site comes from database for examples www.noidatut.com What ever you see on the web site it comes from the database. There are various functions used in php to encrypt the data in case of password or sensitive data.
PHP stands zero without database connectivity or Sql. It uses Sql to create , insert, delete, modify update. PHP super Global variables makes this language special in the world of web development. Using PHP you can insert larger data in the database as well. PHP has the ability to read all the queries from the web page. There are various framework verison of PHP. PHP laveral, PDO are different frame versions of PHP.
|2. What are Advantages of PHP that makes it different from other languages and special ?
All the PHP based applications can run on various types of platforms.PHP is supported by majority of Operating Systems, some of which includes Solaris, UNIX, Windows and Linux. The mentioned platforms can be used to write codes in PHP and also view web pages or run the PHP based applications.
PHP easily interfaces with MySQL and Apache both. An effortless integration of PHP can be done with various other technologies like Java and there is no requirement of re-development. Therefore, saving both time and money, giving it an important advantage.
Easy Database Connection
A programming language like PHP is widely used on the internet and needs to connect to the database very often. Therefore, having a feature that could help PHP to connect to database easily is mandatory. Several websites such as the ecommerce websites, require good database management system.
PHP has a built-in module that helps it in connecting with database easily. Therefore, PHP has a great demand in the field of web development where a data driven website needs to be developed. PHP significantly reduces the time needed in developing the web application that needs an efficient database management system.
Easy To use
PHP is widely used because it is easy to use. In contrast with other programming languages that are complex, PHP is simple, fluent, clean and organized, hence it is a boon for the new users. PHP has a well-organized syntax which is logical at the same time..
One of the important advantages of PHP is that it is Open Source. Therefore, PHP is readily available and is entirely free. In contrast to other scripting languages used for web development which requires the user to pay for the support files, PHP is open to everyone, anytime and anywhere.
A beginner in PHP need not worry about the support as PHP is maintained and developed by a large group of PHP developers which helps in creating support community of PHP that helps people in PHP implementation and manipulation.
A very vital side of web development is the speed. Considering the very important fact, some individuals still struggle with the challenge of web data speed. A quick loading website always appreciated by many individuals. Furthermore, individuals typically like quick loading web sites compared to slower loading ones. Folks use PHP because of the important fact that it’s quick. A very vital side of web development is the speed. Considering the very important fact, some individuals still struggle with the challenge of web data speed. A quick loading website always appreciated by many individuals. Furthermore, individuals typically like quick loading web sites compared to slower loading ones. Folks use PHP because of the important fact that it’s quick.
PHP has been in existence for about twenty-two years. Over this era, many developers have worked on the application to enhance the usage of the application. lots of bugs are discovered over the years and therefore the bugs are fixed quickly by the team of developers. Based on this, the programming language is currently very stable.
|3. What are disadvantages of PHP? Specify Point wise
Disadvantages of PHP
1. Weak Data Type : By the way, the PHP preprocessor hypertext language was created, it’ll be tough to use it to program large applications. Since the programming language isn’t extremely modular, large applications created out of the programming language are tough to keep up. Furthermore, it’s so an excellent language for web site scripting and developing small applications.
2. Poor Error Handling : It is widely believed by the developers that PHP has a poor quality of handling errors. PHP lacks debugging tools, which are needed to search for errors and warnings. PHP has less number of debugging tools when compared to other programming languages.
|4. What are features of PHP ?
Features of php
It is most popular and frequently used world wide scripting language, the main reason of popularity is; It is open source and very simple.
• Open Source
• Case Sensitive
• Platform Independent
• Error Reporting
• Loosely Typed Language
• Real-Time Access Monitoring
|5. Elaborate importance of POST Method in PHP .
Post Method :
Post method is used to send data from one page to another . The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.
• The POST method does not have any restriction on data size to be sent.
• The POST method can be used to send ASCII as well as binary data.
• The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure.
• The PHP provides $_POST associative array to access all the sent information using POST method.
When to use POST?
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.
Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.
However, because the variables are not displayed in the URL, it is not possible to bookmark the page.
|6. Why is PHP referred as back end language? Support your answers with example.
PHP is hypertext preprocessor and is mainly used for connection with the database. It is mainly responsible for connection , once connection is created, once can insert modify, edit database.
It executes in server along with maximum all available web servers like Apache, IIS(Internet Information Server) etc.., and return the response as required MIME type. it is a Pre Process Hypertext, we could do many things on server by using PHP on server and co-ordinate with DB server for CURD(Create, Update, Read, Delete) actions.
|7. How is image inserted in a web page? Support your answers with example.
The tag defines an image in an HTML page.
The tag has two required attributes: src and alt.
Images are not technically inserted into an HTML page, images are linked to HTML pages. The tag creates a holding space for the referenced image.
It also has height and width attributes to define the properties of images. check the example above .
To link an image to another document, simply nest the tag inside tags
|8. What are tags and attributes in HTML. Support your answers with examples.
HTML tags can be taken as functions which defines the page . Like wise we have image tag, anchor tags, please refer the image above for tags .
Attributes provide additional information about HTML elements.
All HTML elements can have attributes
Attributes provide additional information about an element
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
|9. Write short notes in HTML meta elements ?
Metadata is data (information) about data.
The tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.
Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.
The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.
HTML5 introduced a method to let web designers take control over the viewport (the users visible area of a web page), through the tag
Note: tags always go inside the element.
Note: Metadata is always passed as name/value pairs.
Note: The content attribute MUST be defined if the name or the http-equiv attribute is defined. If none of these are defined, the content attribute CANNOT be defined.
|10. Write short notes on html unordered lists. Support your answers with examples.
HTML lists refers to listing of elements. We either list elements as numbered or without numbers. Please refer the image above. Referring or listing the elements without number comes under unordered list. check the example above.
|11. Write short notes on ordered lists. Support your answers with examples.
HTML ordered lists are to present the list in a web page by numbering . please check the examples above.