Write a PHP program to create a new string using three copies of the last two character of a given string of length atleast two

  • برمجة بي اتش بي

Write a PHP program to create a new string using three copies of the last two character of a given string of length atleast two

الأجوبة

<?php
function test($s1)
{
    $last2 = substr($s1, strlen($s1) - 2);
            return $last2 . $last2 . $last2;
}

echo test("Hello")."\n";
echo test("Hi");

Sample Output:

lololo
HiHiHi
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...