Write a PHP program to check if a string 'yt' appears at index 1 in a given string. If it appears return a string without 'yt' otherwise return the original string
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
function test($s)
{
return substr($s, 1, 2) == "yt" ? substr($s, 0, 1).substr($s, 3, strlen($s)-2) : $s;
}
echo test("Python")."\n";
echo test("ytade")."\n";
echo test("jsues")."\n";
Sample Output:
Phon ytade jsues
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال