Page 1 of 1

Modern PHP

Posted: Sun Aug 30, 2009 4:31 am
by kaisellgren
I am wondering if and when PHP might become more "modern". For example, right now all we do is call some global functions that are named with no clear rules. What would you think if PHP 6/7 implements classes for everything we have used previously, like:

Code: Select all

$string = new String;
$test = 'Devnetwork is my home';
$string->explode(' ',$test);
Typing becomes slower, but other than that, I like this kind of approach. Actually, we could achieve this already by the use of our own scripted classes. One could create a string -class, which calls the global functions and implement a lot more new string methods, too.

And what about Exceptions? Many functions return false upon failure and pushes one more entry in the error messages stack. Instead we could have something like:

Code: Select all

try
{
 fopen(...);
}
catch (Exception $e)
{
 // Damn, do something
}
These kind of changes would quite radically affect our code. Anyway, have there been any sort of discussion of any of this?

Right now PHP seems huge mess to me with all its global functions...

Re: Modern PHP

Posted: Sun Aug 30, 2009 8:47 pm
by Benjamin
Insanity 8O

The naming conventions for the existing functions and argument orders are not standardized. I'll be damned if all the method calls would be. I'd probably quit programming all-together.