Python string slices in PHP