I
I
Ivan Petrov2016-12-18 19:52:20
PHP
Ivan Petrov, 2016-12-18 19:52:20

What is this (new someClass($_POST));?

I noticed the following code in one project:
(new someClass($_POST)); ?
do we just create an object without assigning it to any variable? In theory, we only need the __construct function to work.
what is this approach called or what to read on the topic? where else is something like this used?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Snewer, 2016-12-18
@Snewer

Most likely, the variable is passed to the constructor by reference, and how it is processed.
Bad option.

K
kazmiruk, 2016-12-18
@kazmiruk

The approach is called govnokod. Read - any article from Google on request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question