Newer
Older
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
private function uniqElements(array $array): array {
return array_unique($array, SORT_REGULAR);
}
#[Route('/', name: 'home')]
public function home(): Response
{
$arr = [
['laravel', 'php'],
['codeigniter', 'php'],
['laravel', 'php'],
['c++', 'java'],
];
return $this->json($this->uniqElements($arr));