• 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

Why is this PHP array not the same?

phparrays


PHP Snippet 1:

array( 'items[0][type]' => 'screenprint')

PHP Snippet 2:

$data = array('items' => array(0 => array('type' => 'screenprint')));

PHP Snippet 3:

$data = [
    'items' => [['type' => 'screenprint']]
];
echo $data['items'][0]['type'];

Related Snippets

How to disable only_full_group_by option in Laravel

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Can I write PHP code across multiple lines per statement?

Combine array with same value and add other [duplicate]

Pass an image through AJAX [duplicate]

php 7 php.ini upload_max_filesize not working

Best way to scrolldown onpageload

Using Associative arrays

Wordpress add responsive srcset header image to theme

Convert every two values of an associative array into key-value pairs

Clients authentication and user authentication with laravel

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

How to loop sql table data inside a html table

How to find phpcs current default standard

Distribute array row data to make multiple new rows

About Contact Privacy policy Terms and conditions