Hello.

I'd like to suggest PHP introduce a new function |str_cut| to make fast cutting 
of a string.



If the user wants to cut a large string to a still-very-large string(say, 
cutting a 1KB string from a larger string),
|str_cut| would be a far more efficient alternative solution than |substr|:


str_cut($str, 1024) vs $str = substr($str, 0, 1024)

|str_cut| works by *directly* reseting the len value of the string.

And I have created a first-draft PR at https://github.com/php/php-src/pull/3483 
, I am also going to create an RFC.

I am looking forward to your thoughts.


Zhang Junzhi
  





Reply via email to