Q:

Write a PHP program to remove the character in a given position of a given string. The given position will be in the range 0..string length -1 inclusive

0

Write a PHP program to remove the character in a given position of a given string. The given position will be in the range 0..string length -1 inclusive.

All Answers

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

<?php
function test($s, $n) 
{
   return substr($s,0,$n).substr($s,$n+1,strlen($s)-$n);
}

echo test("Python", 1)."\n";
echo test("Python", 0)."\n";
echo test("Python", 4)."\n";

Sample Output:

Pthon
ython
Pythn

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