Q:

Write a PHP program to insert a given string into middle of the another given string of length 4

0

Write a PHP program to insert a given string into middle of the another given string of length 4

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
function test($s1, $word)
{
    return substr($s1, 0, 2) . $word . substr($s1, 2);
}

echo test("[[]]","Hello")."\n";
echo test("(())", "Hi");

Sample Output:

[[Hello]]
((Hi))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now