Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php // а есть какая-то специальная функция, которая делит массив на части по одинаковому значению? // например, есть: $arr = [ ['id' => 1, 'smth' => 'sdfffs'], ['id' => 1, 'somewhere' => 'sdfasd'], ['id' => 1, 'anything' => 'sdfasd'], ['id' => 2, 'whatever' => 'asdfsv'], ['id' => 2, 'somewhere' => 'cvxczd'], ['id' => 2, 'sds' => 'ehgfxg'], ['id' => 2, 'what123' => 'sdfawerqwsd'] ]; $res = array_chunk($arr, 4); print_r($res);
Copy Clear