random1 Posted February 16, 2010 Share Posted February 16, 2010 Hey All, How do you override PHP methods in PHP? I'd like to override 'strtolower' with a utf-8 compliant method. Do I simply redeclare the function with new logic? Quote Link to comment https://forums.phpfreaks.com/topic/192220-overriding-php-methods/ Share on other sites More sharing options...
premiso Posted February 16, 2010 Share Posted February 16, 2010 PHP does not allow overriding. You have two options that I know of. 1: Re-compile PHP with your new logic. 2: Create a new function with a different name that has the logic you want (IE: create a function strtolower_utf8) Quote Link to comment https://forums.phpfreaks.com/topic/192220-overriding-php-methods/#findComment-1012951 Share on other sites More sharing options...
PFMaBiSmAd Posted February 16, 2010 Share Posted February 16, 2010 These two links might or might not help - http://www.php.net/manual/en/mbstring.overload.php http://www.php.net/manual/en/function.mb-strtolower.php Quote Link to comment https://forums.phpfreaks.com/topic/192220-overriding-php-methods/#findComment-1012961 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.