How to Get All Possible Pairs in Array using PHP ?
Given an array containing some elements, the task is to find all possible pairs of array elements using PHP.Examples:Input: arr = [1, 2, 3]Output: [[1, 2], [1, 3]]Input: arr = [1, 2, 3, 5]Output: [[1, 2], [1, 3], [1, 5], [2, 3], [2, 5], [3, 5]]Table of ContentUsing Nested for LoopsUsing array_reduce