- var_dump: documentation ( source)
- preg_replace_callback: documentation ( source)
- strrev: documentation ( source)
<?php
$word = "word,!pineapple--pizza";
$revd = preg_replace_callback('#([A-Za-z]+)#', 'rev_first', $word);
function rev_first($matches){
return strrev($matches[1]);
}
var_dump($revd);