I want to cut string with replacement
$string = "my super very long string";
$start = 3;
$end = 17;
I need cut from $start to $end and replace it with $short = "short"
Result must be "my short string";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use substr_replace() like so:
You can see a working example on this codepad.
Whenever you want to do string manipulation, it’s a good idea to take a look at the string functions in the PHP manual to see if PHP has a function that does what you need.