• 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

Split comma separated value from table column into rows using mysql?

I need to link Google Sheet with my Laravel

How to prevent phpmailer sending embedded image as an attachment on Gmail?

Hide email address with stars (*)

Input and output values for php into the browser?

Reload parent page after submit in iframe

Symfony Mercure "Failed to send an update"

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

how to prevent float variables displaying as scientific notation when printing [duplicate]

php curl requesting twice

PHP: How to quickly split a key=value file into associative array

PHP, how to convert Int value to Week days

PHP: set a (deep) array key from an array [closed]

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

Which is faster php date functions or carbon?

About Contact Privacy policy Terms and conditions