News for hackers. Stuff that matters.
Re:PHP needs to die. What will replace it? by jlgbecom on Monday September 27, 2010 @04:05PM (#1733156)
Unless you're being more specific than I think you are, PHP5 has basic support for method chaining, I use it all the time.
Re:PHP needs to die. What will replace it? by byoung2 on Monday September 27, 2010 @04:33PM (#1733288)
I use structures like this in PHP5 all the time:

  $object->doThis()->doThat()->doTheOther();
But maybe he is referring to method chaining using PHP's built-in functions. There isn't a way that I'm aware of to do the following (short of wrapping the built-in functions with your own classes):

  $string->preg_replace("/[^A-Za-z]+/","_")->trim()->upper();
Re:PHP needs to die. What will replace it? by seldo on Monday September 27, 2010 @05:13PM (#1733443)
Precisely what I meant, thanks for clarifying.
Re:PHP needs to die. What will replace it? by BerislavLopac on Wednesday September 29, 2010 @06:20PM (#1741368)
But this is not method chaining, that's simple function nesting, and can easily be done as:

$string = preg_replace("/[^A-Za-z]+/","_", trim(upper($string)));

Or am I missing your point?