programming-examples/php/String/PHP script to insert a string at the specified position in a given string..php

7 lines
205 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?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";
?>