Difference between PHP 4 and PHP 5

Warning message

JQuery Cycle must be installed in order to run the slideshow. Please go to Status Report for instructions.

Primary tabs

1. PHP 4 and PHP 5 (up to version 5.1), you can print an object directly. This casts the object to a string
containing the object’s ID. From PHP 5.2 onwards the language no longer supported this magic, and any attempt
to treat an object as a string now causes an error unless a method called __toString() is defined in the object’s

2.The visibility keywords public, private, and protected were introduced in PHP 5. If you are running
PHP 4, these examples will not work for you. In PHP 4, all properties were declared with the var keyword, which is
identical in effect to using public. For the sake of backward compatibility, PHP 5 accepts var in place of public
for properties.

3.PHP 4 does not recognize visibility keywords for methods or properties. Adding public, protected, or
private to a method declaration will cause a fatal error. All methods in PHP 4 are implicitly public.