• 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

PHP -> Next nearest date defined by array of days in week

How to get unique slug to same post-title for other time too?

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

How do I upload a laravel project on cPanel shared hosting?

Can we define variables in `.tpl` files?

How to use PHPCBF to fix one issue at a time?

how to redirect the user back to desired URL after login page in PHP?

Getting output of MS stored procedure on php call

How to redirect to another page after n seconds in wordpress without using javascript?

WooCommerce - unset "<product> removed notice…" on cart page

How to reset Laravel AuthManager/guards in between API calls in tests?

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

how to get the header value, if we don't know the value because the value is random from the server

Reducing authentication calls on external API (Laravel 5.6)

Substitute integers and dots with regex [duplicate]

About Contact Privacy policy Terms and conditions