Write a PHP program to create a new array containing the middle elements from the two given arrays of integers, each length 5
- برمجة بي اتش بي
- 2021-09-08
- mhanasmh00489829403
الأجوبة
<?php
function test($nums1, $nums2)
{
return [$nums1[2], $nums2[2]];
}
$nums1 = [10, 20, -30, -40, 30];
$nums2 = [10, 20, 30, 40, 30];
echo "Original array1: " . implode(',', $nums1) . "\n";
echo "Original array2: " . implode(',', $nums1) . "\n";
$result = test($nums1, $nums2);
echo "New array: " . implode(',', $result);
Sample Output:
Original array1: 10,20,-30,-40,30 Original array2: 10,20,-30,-40,30 New array: -30,30
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال