Jump to content

multi level methods?


The Little Guy

Recommended Posts

In javascript you can do multiple methods on the same line like:

if(document.getElementById('myElement').className.match(/^[0-9]/)){/*Do something*/}

 

in that we have getElementById() and match() on the same line, and it works the same as if you were to split them on multiple lines.

 

Is it possible to do that with php?

 

For example:

$obj = new MyObject();

$obj->add(2, 3)->to_string();

Link to comment
https://forums.phpfreaks.com/topic/234790-multi-level-methods/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.