Tuesday, July 17, 2012

PHP

Get More Customers

Get More Shoppers, Get More Sales!!!

With no day-to-day current of shoppers you cannot have reliable everyday revenue.
It's not possible to get revenue if no one comes to your web-site. You have to have visitors to see your web-site, every day, 24 hours!
We help more than 30,000 clients get more customers online.
You will get more sales by receiving thousands of real interested visitors to see your website.
More Customers...

Increase search engine rankings

Increase your web-site search engine rank

Be presented on search engines is one of the most important strategy to increase web-site traffic and expose your content or service to people that might be interested in what you are offering.
All big search engines utilize an algorithm to calculate your website ranks.
They know the number of websites are linking to your web-site; more referrers and hits higher rank for your web site.
Get Better Rank...

Promote to over 10 million customers

Advertise to over 10 million users around the world.

We advertise your company in global network of affiliate webpages, each with own narrow points of interests.
Our company gives you innovative promotion methods that helps you succeed on the Internet.
We will give you real and visible results and take your website to the next level.
Advertise to Millions customers Now...


v Interfaces.
Gives the ability for a class to fulfill more than one is-a relationships. A class can inherit only from one class, but may implement as many interfaces as it wants:

interface Display
{
function display();
}
class Circle implements Display
{
function display()
{
print "Displaying circle\n";
}
}

v Instanceof  operator.
Language-level support for is-a relationship checking. The PHP 4 is_a() function is now deprecated:

If ($obj instanceof Circle)
 {
print '$obj is a Circle';
}

v Final methods.
The final keyword allows you to mark methods so that an inheriting class cannot overload them:

class MyClass
{
final function getBaseClassName()
 {
return __CLASS__;
}
}

v Final classes.
After declaring a class as final , it cannot be inherited. The following example would error out.

final class FinalClass
{

}
class BogusClass extends FinalClass
{

}

v Explicit object cloning.
To clone an object, you must use the clone keyword. You may declare a __clone() method, which will be called during the clone process (after the properties have been copied from the original object):
New Object-Oriented Features:

The new OO features are too numerous to give a detailed description in this section. Chapter 3, “PHP 5 OO Language,” details each feature.

The following list provides the main new features:

v  Public / private / protected access modifiers for methods and properties.

Allows the use of common OO access modifiers to control access to methods and properties:
class MyClass
{
private $id = 18;
public function getId()
{
return $this->id;
}
}

v  Unified constructor name __construct(). Instead of the constructor being the name of the class, it is now declared as __construct() , which makes it easier to shift classes inside class hierarchies:
class MyClass
{
function __construct()
{
print "Inside constructor";
}
}

v  Object destructor support by defining a __destructor() method. Allows defining a destructor function that runs when an object is destroyed:
class MyClass
 {
function __destruct()
{
print ”Destroying object”;
}
}

New Object-Oriented Model:

       When Zeev Suraski added the object-oriented syntax back in the days of PHP 3, it was added as “syntactic sugar for accessing collections.” The OO model also had support for inheritance and allowed a class (and object) to aggregate both methods and properties, but not much more. When Zeev and Andi Gutmans rewrote the scripting engine for PHP 4, it was a completely new engine; it ran much faster, was more stable, and boasted more features. However, the OO model first introduced in PHP 3 was barely touched. Although the object model had serious limitations, it was used extensively around the world, often in large PHP applications. This impressive use of the OOP paradigm with PHP 4, despite its weaknesses, led to it being the main focus for the PHP 5 release.

      So, what were some of the limitations in PHP 3 and 4? The biggest limitation (which led to further limitations) was the fact that the copy semantics of objects were the same as for native types. So, how did this actually affect the PHP developer? When assigning a variable (that points to an object) to another variable, a copy of the object would be created. Not only did this impact performance, but it also usually led to obscure behavior and bugs in PHP 4 applications because many developers thought that both variables would point at the same object, which was not the case. The variables were instead pointing at separate copies of the same object. Changing one would not change the other.

For example:

class Person {
var $name;
function getName()
{
return $this->name;
}
function setName($name)
{
$this->name = $name;
}
function Person($name)
{
$this->setName($name);
}
}
function changeName($person, $name)
{
$person->setName($name);
}
$person = new Person("Andi");
changeName($person, "Stig");
print $person->getName();


          In PHP 4, this code would print out
 & signs.
         This behavior is not intuitive, as many developers would expect the Javalike behavior. In Java, variables actually hold a handle (or pointer) to the object, and therefore, when it is copied, only the handle (and not the entire
object) is duplicated.

        There were two kinds of users in PHP 4: the ones who were aware of this problem and the ones who were not. The latter would usually not notice this problem and their code was written in a way where it did not really matter if the problem existed. Surely some of these people had sleepless nights trying to track down weird bugs that they could not pinpoint. The former group dealt with this problem by always passing and assigning objects by reference. This would prevent the engine from copying their objects, but it would be a headache because the code included numerous

       The old object model not only led to the afore-mentioned problems, but also to fundamental problems that prevented implementing some additional features on top of the existing object model. In PHP 5, the infrastructure of the object model was rewritten to work with object handles. Unless you explicitly clone an object by using the
clone keyword, you never create behind-the-scenes duplicates of your objects. In PHP 5, you don’t need a need to pass objects by reference or assign them by reference.
"Andi" . The reason is that we pass the object $person to the changeName() function by-value, and thus, $person is copied and changeName() works on a copy of $person.