0

A string contains some characters that needs to be deleted. $a = "abcdefghijlkmnopqrstuvwxyz"; I want to delete 5,6,7,8th character from the text. every time characters are shuffled. and i want to delete those characters which are placed at 5th to 8th position

Abdur Rehman
  • 41
  • 11

1 Answers1

0

You can do it with substr.

$new_string = substr($a, 0, 4) . substr($a, 8);

or, as say @MarcB, you can use substr_replace

$new_string = substr_replace($a, '', 4, 4);
Federkun
  • 36,084
  • 8
  • 78
  • 90