Undefined lcfirst ()

Fatal error: call to undefined lcfirst () in C: \ xampp \ htdocs \ allsides \ others \ basecontroller.php on line 9

Why didn't he find the Text Proccessing function mentioned in the official php manual ( http://www.php.net/manual/en/function.lcfirst.php )?

+6
function php undefined
source share
2 answers

Check version: (PHP 5 >= 5.3.0)

You obviously have a lower version. :)

Use phpversion() to quickly check which version you have.

As noted in the comments, this function is trivially easy to replicate:

 if(function_exists('lcfirst') === false) { function lcfirst($str) { $str[0] = strtolower($str[0]); return $str; } } 

You can throw the above code somewhere in the project library / utilities file and it will not break when / if you upgrade to 5.3.0 along the way.

+18
source share

On the PHP manual page you provided:

(PHP 5> = 5.3.0)

This function exists only if you are using PHP version 5.3 or later.

+5
source share

All Articles