Using $this when not in object context ... stack issue?
<p>I'm getting the error <strong>Using $this when not in object context</strong> when using the code below. Is this because the function is on the stack and has no access to the object?</p>

<pre><code>array_walk($pins, function (&amp;$array) {
$array-&gt;timestamp = $this-&gt;convertTime(strtotime($array-&gt;timestamp));
});
</code></pre>

<p>What's the best way to get around this? I was thinking of using a foreach, but wanted to learn more of PHP's lesser used functions that suit the purpose.</p>

<p>Solved it with</p>

<pre><code>foreach($pins as $pin) {
    $pin-&gt;timestamp = $this-&gt;convertTime(strtotime($pin-&gt;timestamp));
}
</code></pre>

<p>But I would still like to know how to get around the issue with array_walk.</p>
