What is wrong with this PHP function.
Posted
by [email protected]
on Stack Overflow
See other posts from Stack Overflow
or by [email protected]
Published on 2010-04-28T12:44:17Z
Indexed on
2010/04/28
16:53 UTC
Read the original article
Hit count: 175
I am new to PHP
and regular expression. I was going thorugh some online examples and came with this example:
<?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>
in php.net
but to my surprise it does not work and keep getting error:
PHP Parse error: parse error, unexpected T_FUNCTION
Why get error ?
© Stack Overflow or respective owner