Write a PHP script to insert a string at the specified position in a given string.
Original String : 'The brown fox'Insert 'quick' between 'The' and 'brown'
<?php $original_string = 'The brown fox'; $string_to_insert ='quick'; $insert_pos = 4; $new_string = substr_replace($original_string, $string_to_insert.' ', $insert_pos, 0); echo $new_string."\n"; ?>
Sample Output:
The quick brown fox
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer