Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
A PHP array is an ordered map that associates keys with values. PHP supports three array types: indexed (auto-assigned numeric keys), associative (named string keys), and multidimensional (arrays containing other arrays). Arrays are the most versatile data structure in PHP — used for configuration, form handling, database results, and data interchange.
Converting Excel data to a PHP array produces a ready-to-paste code block you can drop into Laravel seeders, configuration files, WordPress plugins, PHPUnit data providers, or any PHP script that needs tabular data.
| Type | Short Syntax [] | Legacy Syntax array() |
|---|---|---|
| Indexed | ["Alice", "Bob", "Carol"] | array("Alice", "Bob", "Carol") |
| Associative | ["name" => "Alice"] | array("name" => "Alice") |
| Multidimensional | [["Alice", 30], ["Bob", 25]] | array(array("Alice", 30)) |
| Mixed keys | [0 => "a", "name" => "b"] | array(0 => "a", "name" => "b") |
Laravel seeders — Paste converted arrays directly into database/seeders/ files to populate tables with initial or test data.
PHPUnit data providers — Generate array datasets from spreadsheet test cases for parameterized tests.
Configuration files — Store lookup tables, status codes, or country lists as PHP config arrays that return data directly.
WordPress plugins — Define option lists, shortcode attributes, or metabox configurations from spreadsheet-based specs.
Data migration — Move spreadsheet data into PHP-based systems without intermediate CSV parsing or database imports.
Rapid prototyping — Convert product catalogs, pricing tiers, or geographic data into arrays you can iterate over immediately.
Drag-and-drop upload — Drop any .xlsx, .xls, or .xlsm file onto the upload zone.
Built-in table editor — Modify cell values, add or delete rows and columns, transpose, deduplicate, and apply case transformations before conversion.
Multi-sheet support — Switch between worksheets in multi-sheet workbooks via the sheet selector dropdown.
First Row as Header toggle — Control whether the first row is treated as column headers (producing associative arrays) or regular data (producing indexed arrays).
Find & Replace — Bulk-replace cell values with optional regex and case-sensitive matching.
Undo / Redo — Full edit history so you can revert mistakes.
Copy to clipboard — One-click copy of the generated PHP array code.
100% client-side — Your spreadsheet data never leaves your device. No files are uploaded to any server.
Upload your file — Drag an .xlsx, .xls, or .xlsm file onto the upload area, or click Click here to choose to browse.
Edit if needed — Use the built-in table editor to modify values, add or remove rows and columns, transpose, deduplicate, or apply case changes.
Set options — Toggle First Row as Header on for associative array output (column names as keys) or off for indexed array output (numeric keys).
Click Convert — Press the Convert button in the Properties panel. The PHP array output appears in the Output Data area.
Copy the result — Click Copy to Clipboard and paste the PHP code into your project.
Input spreadsheet (employees.xlsx):
| Name | Department | Salary |
|---|---|---|
| Alice | Engineering | 95000 |
| Bob | Marketing | 72000 |
| Carol | Engineering | 102000 |
Generated PHP array output (First Row as Header OFF — indexed):
[
["Name", "Department", "Salary"],
["Alice", "Engineering", "95000"],
["Bob", "Marketing", "72000"],
["Carol", "Engineering", "102000"]
]
Generated PHP array output (First Row as Header ON — associative):
[
["Name" => "Alice", "Department" => "Engineering", "Salary" => "95000"],
["Name" => "Bob", "Department" => "Marketing", "Salary" => "72000"],
["Name" => "Carol", "Department" => "Engineering", "Salary" => "102000"]
]
<?php
namespace DatabaseSeeders;
use IlluminateDatabaseSeeder;
use AppModelsEmployee;
class EmployeeSeeder extends Seeder{
public function run()
{
$employees = [
["Name" => "Alice", "Department" => "Engineering", "Salary" => "95000"],
["Name" => "Bob", "Department" => "Marketing", "Salary" => "72000"],
["Name" => "Carol", "Department" => "Engineering", "Salary" => "102000"],
];
foreach ($employees as $row) {
Employee::create([
'name' => $row['Name'],
'department' => $row['Department'],
'salary' => (int) $row['Salary'],
]);
}
}
}
| Aspect | Indexed (Numeric Keys) | Associative (String Keys) |
|---|---|---|
| Access pattern | $row[0], $row[1] | $row["Name"] |
| Readability | Lower — must remember column order | Higher — self-documenting keys |
| Memory | Compact | Slightly larger (key storage) |
| Column reorder safety | Breaks if columns move | Safe — keyed by name |
| Best for | Matrices, coordinate data, simple lists | Seeders, configs, API payloads |
Use the First Row as Header toggle to switch between indexed and associative output.
| Function | Description | Example |
|---|---|---|
count() | Number of elements | count($data) // 3 |
array_column() | Extract a single column | array_column($data, "Name") |
array_map() | Transform each element | array_map(fn($r) => $r["Salary"], $data) |
array_filter() | Filter by condition | array_filter($data, fn($r) => $r["Department"] === "Engineering") |
array_push() | Append an element | array_push($data, ["Name" => "Dave"]) |
foreach | Iterate over elements | foreach ($data as $row) { ... } |
The tool accepts Microsoft Excel files in .xlsx, .xls, and .xlsm formats. LibreOffice and Google Sheets files exported as .xlsx also work.
No. All processing happens entirely in your browser using client-side JavaScript. Your file never leaves your device. There are no server uploads, transfers, or storage of any kind.
The tool generates the short array syntax [] introduced in PHP 5.4, which is the modern standard. All modern PHP frameworks (Laravel, Symfony, WordPress) support this syntax.
With First Row as Header disabled, each row becomes a numeric-keyed array — accessed by position ($row[0]). With it enabled, each row becomes an associative array — accessed by column name ($row["Name"]). Associative arrays are more readable and preferred for seeders, configs, and API payloads.
Yes. After uploading, a full table editor appears. You can modify individual cells, add or delete rows and columns, transpose the table, remove duplicates, apply case transformations (UPPERCASE, lowercase, Capitalize), and perform find-and-replace operations.
Yes. When your workbook contains multiple sheets, a dropdown selector appears in the editor header. Choose the sheet you want to convert.
The converter outputs all cell values as strings to preserve fidelity. In your PHP code, cast types as needed: (int) $row["Salary"] or (float) $row["Price"].
Since processing is entirely client-side, the limit depends on your browser's memory. Most modern browsers handle workbooks with tens of thousands of rows without issues.