stream context for custom stream wrappers <p>In the code snippet that follows this paragraph I'm creating a stream wrapper called test using the Test_Stream object. I'm trying to use stream context's with it and have a few questions. First here's the code:</p> <pre><code>&lt;?php class Test_Stream { public $context; public function __construct() { print_r(stream_context_get_options($this-&gt;context)); exit; } } $context = array( 'test' =&gt; array('key' =&gt; 'value'), 'otherwrapper' =&gt; array('key' =&gt;'value') ); $context = stream_context_create($context); stream_wrapper_register('test', 'Test_Stream'); $fp = fopen('test://www.domain.tld/whatever', 'r', false, $context); </code></pre> <p>So right now, in that code snippet, Test_Stream is being registered to the 'test' stream wrapper but... what if I didn't know in advance what the wrapper name would be or what if I wanted to leave it up to the developer to decide. How would you know what the wrapper name was in the class? Seems like you'd have to know it in advance to get the appropriate context options (unless you just assume that the first context option array is the correct one) but what if you weren't going to know it in advance?</p>