Chirayu Chiripal a écrit :
Hi,
On Wed, Sep 24, 2014 at 5:13 PM, Marc Delisle marc@infomarc.info wrote:
Hugues Peccatte a écrit :
2014-09-23 20:04 GMT+02:00 Marc Delisle marc@infomarc.info:
Hugues Peccatte a écrit :
2014-09-23 16:23 GMT+02:00 Marc Delisle marc@infomarc.info:
That's it. Instead of using $pmaString->strlen or strlen, we could
imagine
to use pmaStrlen and this function would call strlen or mb_strlen if
mb_*
functions exist. Another way could be to overwrite strlen with mb_strlen, but we
wouldn't
be
able to use the original strlen if needed. So I think that we should
define
new functions.
What I don't like is that we would have two different syntaxes to call string functions. We would need comments in the calling code to explain why we are using a way and not another way.
I'll try to do a mass replacement and check if the execution time is
better.
Hugues.
-- Marc Delisle (phpMyAdmin)
If by "two ways", you think about PMA_String and pmaStr* functions, there should be a misunderstanding. I don't want to keep PMA_String (at least, not for string functions), I'd like to migrate it into functions. Here, I kept it not to break anything, just to check performance. If you think about pmaStr* functions and standard PHP functions, I don't think this is a real issue, because we use PMA string object almost everywhere today, so it would be replaced by function calls.
Hugues.
I believe it's a good idea to use just functions, but other developers might think otherwise.
In that case, how will function decide whether to use mb_* function or simple one? What if we use static methods?
In the current implementation, the mb_* functions are preferred; so we would use the same priority, to define functions like PMA_substr().