• 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

Implode columnar values between two arrays into a flat array of concatenated strings

Adding one microsecond to Datetime object in PHP

How avoid Moved Permanently The document has moved here

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

Login if user is active using Laravel Breeze

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

Can I use a WooCommerce function without any WooCommerce page?

Check if string contains a value in array [duplicate]

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

Symfony there are no commands defined in the "make" namespace

CodeIgniter 4: Like and Dislike Functionality

Issue saving card for customer

array_key_exists(): The first argument should be either a string or an integer

Generate random username based on full name php

PHP array_filter with arguments

About Contact Privacy policy Terms and conditions