Reputation: 146640
Two key concepts in the PHP streams feature are context options and parameters. What is the difference between «option» and «parameter»?
Documentation about the former is fairly straightforward. It seems an option is a protocol specific setting, e.g. "method" (get, post, put...) if you are using HTTP or "callback function to be called when inserting a document" in MongoDB.
What's a parameter then? The stream_context_set_params()
manual page contains a sparse reference to Supported parameters being "notification" and "options" (options??). The Context parameters page only mentions "notification", as if they had great plans for the future when PHP/4.3.0 was released but they never bloomed.
Upvotes: 4
Views: 91
Reputation: 158250
Update:
I did some research and found out, that the code is really old, it was introduced by commit e1d0a1479
and kept more or less unchanged since that time. (2003/04/10)
The author of this code was Wez Furlong. I would ask him, since I fear that nobody can provide a better answer. (Find his email address on github)
IMHO parameters (there is only one atm), can be used for all context wrappers where options are specific for a certain type of wrapper.
Actually you can set two different parameters with stream_context_set_params()
: notification
(as named above) and (this might be suprising) options
which is an assoc array with options that could be also set using stream_context_set_options()
.
It looks like the stream_context_set_params()
function is a more generic attempt, however I still don't get the advantage of that concept completely atm.. Would need to have a look at the code and the commit history.
Upvotes: 2