3 ms·
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-i
by byoung2 16y ago
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();
- seldo 16y agoPrecisely what I meant, thanks for clarifying.
- BerislavLopac 16y agoBut 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?