Answers for "create a subset of an array php"

PHP
4

limit offset array php

array_slice($array, 0, 50); // same as offset 0 limit 50 in sql
Posted by: Guest on September-02-2020
0

create a subset of an array php

$input_array = array('a', 'b', 'c', 'd', 'e');
print_r(array_chunk($input_array, 2));

OR

Array
(
    [0] => Array
        (
            [0] => a
            [1] => b
        )

    [1] => Array
        (
            [0] => c
            [1] => d
        )

    [2] => Array
        (
            [0] => e
        )

)
Posted by: xss on March-10-2022

Code answers related to "create a subset of an array php"

Browse Popular Code Answers by Language