How to extract substring by start-index and end-index? May 1, 2023 by Tarik It’s just math $sub = substr($str, 3, 5 - 3); The length is the end minus the start.