Difference between Php 4 and php5


Difference in object assignment: 



  
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");
echo "Name is :". $person->getName();

Result:
Php 4 :Name is Andi
Php 5 :NAme is Stig

Note: the ones who were aware of this problem , should have a sleepless nights trying to
track down weird bugs that they could not pinpoint.


Hope this blog will help most of the php4 developers

Comments

Popular posts from this blog

D8 KernelEvents constants