Proposal: Please consider introducing a new function |str_cut| to make fast cutting for a string

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Proposal: Please consider introducing a new function |str_cut| to make fast cutting for a string
Groups: php.internals 
Request: Send a blank email to internals+get-103113@lists.php.net to get a copy of this message
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

« previous php.internals (#103113) next »