Monday, May 2, 2016

WDP - PHP


PHP

  • Explain PHP?

PHP (recursive acronym for PHP: Hypertext Preprocessor), PHP is known as a server-sided language, is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

  • Explain WAMP

Acronym for Windows/Apache/MySQL/PHP, Python, (and/or) PERL.
It is a package used by PHP developers to develop their web projects on their local windows system.
It comes with Apache server , MySQL database , PHPMyAdmin and PHP creating a suitable environment to development.

  • Explain the difference between procedural and object-oriented programming in PHP.

Procedural programming uses a list of instructions to tell the computer what to do step-by-step. Procedural programming relies on - you guessed it - procedures, also known as routines or subroutines. A procedure contains a series of computational steps to be carried out. Procedural programming is also referred to as imperative programming. Procedural programming languages are also known as top-down languages.
Procedural programming is intuitive in the sense that it is very similar to how you would expect a program to work. If you want a computer to do something, you should provide step-by-step instructions on how to do it. It is, therefore, no surprise that most of the early programming languages are all procedural. Examples of procedural languages include Fortran, COBOL and C, which have been around since the 1960s and 70s.

Object-oriented programming, or OOP, is an approach to problem-solving where all computations are carried out using objects. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program. Objects are the basic units of object-oriented programming. A simple example of an object would be a person. Logically, you would expect a person to have a name. This would be considered a property of the person. You would also expect a person to be able to do something, such as walking. This would be considered a method of the person.
A method in object-oriented programming is like a procedure in procedural programming. The key difference here is that the method is part of an object. In object-oriented programming, you organize your code by creating objects, and then you can give those objects properties and you can make them do certain things.
A key aspect of object-oriented programming is the use of classes. A class is a blueprint of an object. You can think of a class as a concept, and the object as the embodiment of that concept. So let's say you want to use a person in your program. You want to be able to describe the person and have the person do something. A class called 'person' would provide a blueprint for what a person looks like and what a person can do. Examples of object-oriented languages include C#, Java, Perl and Python.

  • Identify the rules in naming variables in PHP.

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).
Rules for PHP variables:
  • A variable starts with the $ sign, followed by the name of the variable
  • A variable name must start with a letter or the underscore character
  • A variable name cannot start with a number
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-sensitive ($age and $AGE are two different variables)


Reference:
  • http://www.homeandlearn.co.uk/php/php1p1.html
  • http://php.net/manual/en/intro-whatis.php
  • https://www.quora.com/What-is-WAMP-used-for
  • http://www.webopedia.com/TERM/W/WAMP.html
  • http://www.w3schools.com/php/php_variables.asp
  • http://study.com/academy/lesson/object-oriented-programming-vs-procedural-programming.html

No comments:

Post a Comment