Modern PHP
Posted: Sun Aug 30, 2009 4:31 am
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:
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:
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...
Code: Select all
$string = new String;
$test = 'Devnetwork is my home';
$string->explode(' ',$test);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
}Right now PHP seems huge mess to me with all its global functions...