• 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

Merge column values from two arrays to form an indexed array of associative arrays

How to make autocomplete work in foreach php loop? (vscode, intellisense)

How to map the two arrays with a duplicate value?

What is PHP's equivalent of JavaScript's "array.every()"?

How to Generate PDF invoice to XML format using mPDF

How to upload mpdf file after generating to s3 bucket in php

PHP my timezone is no setting up in PHP.ini File in xampp

WHM Enabling mod_rewrite

Laravel phpunit test failing authorization

Laravel 5 session not persisting after user is logged in

301 Redirect to remove query string on homepage only

Edit XML in HTML form and submit to self

Access relation of pivot table in Laravel

Check If array is null or not in php

Why isn't my PHP exception working?

About Contact Privacy policy Terms and conditions