Featured Post

What is the purpose of the php.ini file?

  The PHP configuration file,   php.ini , is the final and most immediate way to affect PHP's functionality. The php.ini file is read ea...

Showing posts with label php variables. Show all posts
Showing posts with label php variables. Show all posts

What are variables in PHP?

 Variables store data and always start with $.

$name = "John";

$age = 25;

Difference between Abstract class and Interfaces.

Abstract class:

  • Abstract class comes under partial abstraction.
  • Abstract classes can maintain abstract methods and non abstract methods.
  • In abstract classes, we can create the variables.
  • In abstract classes, we can use any access specifier.
  • By using 'extends' keyword we can access the abstract class features from derived class.
  • Multiple inheritance is not possible.

Interface:

  • Interface comes under fully abstraction.
  • Interfaces can maintain only abstract methods.
  • In interfaces, we can't create the variables.
  • In interface, we can use only public access specifier.
  • By using 'implement' keyword we can get interface from derived class.
  • By using interfaces multiple inheritance is possible.

The Difference Between Abstract Class and Interface in PHP

 

Introduction 

 
Before diving deep into the difference between abstract class and interfaceyou must understand one basic thing: these are two completely different classes that cannot be used as an alternative to one another.
 
Interface classes completely empty the shells while expecting child classes to implement everything for them. Abstract classes not only contain the common piece of information between the shells inside but also expect the child classes within to fill in the gaps.
 
Let us dive in a bit deeper to actually understand the difference minutely.
 
If you want to read about PHP Array questions then you can visit here. This will help you crack your PHP interviews.

Features and advantages of OBJECT ORIENTED PROGRAMMING?

  • One of the main advantages of OO programming is its ease of modification.
  • Objects can easily be modified and added to a system there by reducing maintenance costs.
  • OO programming is also considered to be better at modeling the real world than is procedural programming.
  • It allows for more complicated and flexible interactions.
  • OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns.
  • For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused.
  • Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.

List of Online PHP Codepads

Yes, there are some. Looking for a PHP version? I was looking for a PHP 5.1 codepad (run PHP code online for test purposes), but was not able to. I remember there was one, but I have not found it.
Here is the list I came up so far before you need to click through hundreds of search results:

CodepadPHP Version(s)Note
writecodeonline.com PHP 4.4.9 Legacy needs?
codepad.org PHP 5.2.5 Many languages, good history
ideone.com PHP 5.2.12 (pl0-gentoo) Many langauges, good history
freephptest.com PHP 5.2.17 Not very accessible
coderun.com (ide) PHP 5.3.1 Not suitable for quick testing
phpcodepad.com PHP 5.3.2 Not very accessible
codepad.viper-7.com PHP 5.2, PHP 5.3, PHP 5.4 + trunk A PHP coders paradise

Global variables of Drupal 7

Scope can be defined as the range of availability a variable has to the program in which it is declared. PHP variables can be one of four scope types:
  1. Local variables
  2. Function parameters
  3. Global variables
  4. Static variables.
Global Variables:
In contrast to local variables, a global variable can be accessed in any part of the program. However, in order to be modified, a global variable must be explicitly declared to be global in the function in which it is to be modified. This is accomplished, conveniently enough, by placing the keyword GLOBAL in front of the variable that should be recognized as global. Placing this keyword in front of an already existing variable tells PHP to use the variable having that name.
Here are the list of Drupal Global Variables:

Popular Posts