PHP - Cut last N chars in string faster than substr($s, 0, -$N) -


i have script trimming strings way billions of times.

$s = substr($s, 0, -$n); 

is there way faster without reassigning string?

by definition strings not mutable in php. "cut" string, you'll have create new string based on original string, making necessary reassign it. code have minimalist way it.


Comments