What is "with" used for in PHP?

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2013-11-11T15:51:15Z Indexed on 2013/11/11 15:52 UTC
Read the original article Hit count: 249

Filed under:

I have come across this line in the eloquent ORM library:

return with(new static)->newQuery();

I've never seen "with" used before, and cannot find it in the PHP documentation. I'm guessing "with" is a stop-word in most searches, so I am not even getting close.

Never having encountered "with" in many years of programming PHP, I feel like I'm missing out. What does it do? I did come across one passing comment regarding the ORM, that mentioned "with" is no longer needed in PHP-5.4, but that was as much as was said.

© Stack Overflow or respective owner

Related posts about php