maecro Posted November 10, 2010 Share Posted November 10, 2010 Hey guys having a problem with the following code which is supposed to change the case of the class name and include the resulting file. function __autoload($class_name) { $class_name = strtolower($class_name); $class_name .= ".php"; include $class_name; } However this throws the following error Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on $class_name .= ".php"; I cannot figure out why I cannot append the string to the result of strtolower, can anyone tell me what's wrong? Quote Link to comment https://forums.phpfreaks.com/topic/218281-string-manipulation-help/ Share on other sites More sharing options...
trq Posted November 10, 2010 Share Posted November 10, 2010 No idea why your getting that error, but considering your function has no error checking of any kind anyway it could be made allot simpler. function __autoload($class_name) { include strtolower($class_name) . '.php'; } Quote Link to comment https://forums.phpfreaks.com/topic/218281-string-manipulation-help/#findComment-1132589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.