• 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

Submitting a form with ajax in Wordpress

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

PHP header location absolute URL

Doctrine 2 mapping referencing unique key

Laravel 8 Multiple Relationships for Factory

Laravel 8 factory state afterCreating

Update Order custom Field value with WooCommerce REST API

Log file is not being written in Laravel 5.5

Laravel implode array items to new lines

Chunk and transpose a flat array into rows with a specific number of columns

best way to store error messages in Laravel (session or variable)

PDOException SQLSTATE[HY000] [2002] No such file or directory

Redis Command To Sort Keys

Passing a boolean value from checkbox in Laravel form

MySQL - Connection failed: No route to host

About Contact Privacy policy Terms and conditions