Write a PHP program to create a new string which is n (non-negative integer) copies of a given string
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
function test($s, $n)
{
$result = "";
for ($i = 0; $i < $n; $i++)
{
$result = $result.$s;
}
return $result;
}
echo test("JS", 2)."\n";
echo test("JS", 3)."\n";
echo test("JS", 1)."\n";
Sample Output:
JSJS JSJSJS JS
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال