Hi josh,
Thank you for the explanation about the modifiers.
New things to learn everyday =)
About the 'use', it is something new for me.
I have checked the phpinfo in my server, it is 5.3.26
but it gives error:
Parse error: syntax error, unexpected T_USE, expecting '{' in filename yada yada
Here is my code:
function makeUppercase($m) use ($test) {
return strtoupper($m[1].$test);
}
$ret = 'the [%quick%] brown fox jumps [%over%] the lazy dog [%lorem%] ipsum dolor sit amet';
$test='foobar';
$ret = preg_replace_callback('#\[%(.+?)%\]#', 'makeUppercase', $ret);
echo $ret;
I guess 'use' can only be used for the 'inline' function right?
I try to avoid using global since it seems not nice for me, but at this point I think there is no other option