• 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

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

How to unlink image from folder?

Minimum order amount except for specific shipping method in WooCommerce

Add restriction to WooCommerce coupons by allowed user ID

Can't call javascript alert alertify library from PHP

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

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

PHP: Insert marker every 3 iterations

Pass a select with mysqli_fetch_row to a table

Edit XML in HTML form and submit to self

PHP mail function is sending blank message body

how to youtube api data to print in toolset metabox using a button click before save-post

How to average columns of data from multiple, flat arrays?

php code to send checkbox form results to email

About Contact Privacy policy Terms and conditions