Can I subscript an array variable inside a double quoted PHP string?
<p>I have an array of custom hooks I'd like to schedule, built along these lines:</p>

<pre><code>public function __construct(WPSM_Logger $injected_logger = null) {
    $this-&gt;cron_hooks[WPSM_CRONHOOK_SENDQUEUE] = array ("frequency" =&gt; 60);
}
</code></pre>

<p>Then, in the constructur for my Scheduler class, I would like to loop through $this->cronhooks and schedule each hook in that array. I normally prefer straight and simple variable expansion within double quoted strings, like what I do with $name below, but I can't seem to figure out how to do this with an array and subscript.</p>

<pre><code>foreach ($this-&gt;cron_hooks as $name =&gt; $options) {
    $freq = $options["frequency"];
    echo "Hook '$name' will run every $freq seconds.";  
}
</code></pre>

<p>I would like to do away with the intermediary <code>$freq = $options["frequency"];</code> line, and have something like this in the <code>echo</code> line:</p>

<pre><code>foreach ($this-&gt;cron_hooks as $name =&gt; $options) {
    $freq = $options["frequency"];
    echo "Hook '$name' will run every $options['frequency]seconds.";    
}
</code></pre>

<p>However, I simply can't get that to work. Is there something special I'm missing, or do I really have to drag an extra variable along to my party?</p>
