Hi,
Yes, you can do OOP in php4. I have been doing OOP for over 10 years,
first in Smalltalk, then in java, now in php. Smalltalk was probably the
first real OO language and it still is one of the simpelest, purest and
most powerfull ones. Both php4 and php5 are easier and more effective
for OOP then Java (and C++) because, like Smalltalk, php has weak typing
and because weak typing also works with primitive datatypes (these
allways give you headaches with Java). I wrote an entire OOP framework
in php4 and i am not the only one, see
http://www.hotscripts.com/PHP/Script...ork/index.html.
In a way php4 is actually more like Smalltalk then php5, because it does
not mess up your mind with nonsense like public, private, protected,
interfaces etc*. But it has two major limitations:
- it implicitly copies objects whenever passed or assigned by value. You
can work around this by allways using references with objects,
- it has no exceptions (try-catch). This is not a big problem for simple
code becuase you will get a reasonable error message and line number,
but if you really do reuse code, the line numbers pointing to the reused
code give little clue about the code that really causes the error. This
makes it hard to debug. It can be worked around too, but that causes
more error handling code in places you do not want it. For the workaroud
see
http://www.phppeanuts.org/site/index.../92/error.html
You can also write code that runs equally (i mean: does the same) on
both php4 and php5. You only need a small wrapper function library and
some coding guidelines. For these download the PHP 5 portable release.
The coding guidelines are in readme.html. The wrapper library is in
classes/pnt/pntPhp4Functions.php and pntPhp5Functions.php, which are
included from classes/pnt/generalFunctions.php. The wrapper library also
explains (partly in the form of code) the main differences between OOP
in php4 and php5.
PhpPeanuts does not work with Oracle. Php4 does, see
http://www.php.net/manual/en/ref.oracle.php. Also see
http://www.php.net/manual/en/ref.oci8.php, look for "Example 2. Using
Stored Procedures".
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
* just an opinion ;-)
ablyplus wrote:
[color=blue]
> What is main difference between PHP 4 and PHP 5?
> Is possible to use object programming apporach with PHP4?
> Is possible to use Stored Procedures in Oracle with PHP4?
>
> Where I can get more informations?
>
> Thanks in advance
>
>[/color]