i would like to see it done more like javascript with un-named function. instead of:<p><pre><code> $replacement = function ($matches) {
return str_replace ($matches[1], ' ', '&nbsp;').' ';
};
return preg_replace_callback ('/( +) /', $replacement, $text);
</code></pre>
do:<p><pre><code> return preg_replace_callback ('/( +) /', function ($matches) {
return str_replace ($matches[1], ' ', '&nbsp;').' ';
}, $text);
</code></pre>
and also make array_map more like Array.each(e) in js:<p><pre><code> $processed = array_map($array, function($e) {
return strtolower($e);
});
</code></pre>
and all the custom defined functions like usort:<p><pre><code> $processed = usort($array, function($a, $b) {
return $a > $b ? 1 : -1;
});</code></pre>