• 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

How to make a array inside array?

phparrays


PHP Snippet 1:

$data['fileToUpload'] = array_map(
  function($item) {
    return [$item];
  },
  $data['fileToUpload']
);

PHP Snippet 2:

 $myArray = [];
 $myArray['fileToUpload']['name'] = array("file name");
 $myArray['fileToUpload']['type'] = array("file type");
 $myArray['fileToUpload']['tmp_name'] = array("temporary name");
 $myArray['fileToUpload']['error'] = array("error");
 $myArray['fileToUpload']['size'] = array("file size");

 echo "<pre>";
 print_r($myArray);

Related Snippets

Yii Ajax Submit button

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Artisan, creating tables in database

WooCommerce: Add/display Product or Variation custom field everywhere

Facebook API, get page post link (PHP)

PHP error: "The zip extension and unzip command are both missing, skipping."

PHP SoapClient: set a namespace without prefix

PHP DOTENV unable to load env vars

PHP-Sort array based on another array?

Handling expired token in Laravel

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

How to pass data to all views in Laravel 5?

I want to display a sweetalert after the inserting of data in my database

Log file is not being written in Laravel 5.5

About Contact Privacy policy Terms and conditions