• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

I want to store data in new index as per my key in php [duplicate]

phparrays


PHP Snippet 1:

$pieces = array_chunk($my_array, 6);

PHP Snippet 2:

<?php
$a = ["a","a","a","a","a","a","a","a"];

$b = array_chunk($a, 7);

echo"<pre>";print_r($b);

?>

PHP Snippet 3:

Array
(
    [0] => Array
        (
            [0] => a
            [1] => a
            [2] => a
            [3] => a
            [4] => a
            [5] => a
            [6] => a
        )

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

)

Related Snippets

Require a class from another class - php

Zig-zag scan an N x N array

Backend cannot be reached after Typo3 login screen

Laravel Schedule not sending email

Laravel relationship belongsToMany with composite primary keys

How do I enable error reporting in Laravel?

How to submit a form when page loads using JavaScript?

How to render html from a @foreach loop in a textarea

How to loop a tree array with unknown depth and get array blocks?

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

PHP DOTENV unable to load env vars

301 Redirect to remove query string on homepage only

how do i retrieve and display the alt text of an image in wordpress?

Using Associative arrays

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

About Contact Privacy policy Terms and conditions