S
S
Sandr-02019-11-04 18:01:43
PHP
Sandr-0, 2019-11-04 18:01:43

Does it make sense to pass $_POST as a parameter?

Does it make sense to do this:

function process($request_data)
{

}

process($_POST);

Or is it better to use $_POST right away in the process function if it's a superglobal anyway?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2019-11-04
@Sandr-0

Using global variables in functions is generally bad practice, one should try to keep the principles of purity of functions , which excludes the use of global variables inside them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question