Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
The Markdown To PHP Array Converter on A.Tools transforms Markdown pipe-delimited tables into valid PHP array code — ready to paste into Laravel config files, database seeders, WordPress templates, or any PHP project. All processing runs in your browser. No data leaves your device.
Tabular data is often documented in Markdown tables within README files, design specs, and wikis. PHP uses arrays as its primary data structure for configuration, data transfer, and templating. This tool converts between the two without manual typing.
Click Enter Data to paste a Markdown table into the input area, or click Choose File to drag and drop a .md file. Press Sample to load example data.
Once parsed, an interactive spreadsheet appears. Use the toolbar to:
Add or delete rows and columns
Transpose the table (swap rows and columns)
Remove duplicate rows
Delete empty rows and columns
Change text case (UPPERCASE, lowercase, Capitalize)
Find and replace values — supports case-sensitive search and regex
Toggle First Row as Header to define array keys
Right-click any cell for context-menu operations.
Click Convert to generate PHP array code. Use Copy to Clipboard or Download File to save as a .php file.
Two input modes: Paste Markdown directly or upload a .md file via drag-and-drop
Full table editor: Edit, transpose, deduplicate, find-and-replace before converting
Client-side processing: Files never leave the browser — zero data upload
Undo/Redo: Full edit history with revert support
Context menu: Right-click for quick row/column/cell operations
Header toggle: Treat the first row as associative array keys or generate indexed output
Validation indicator: Real-time feedback on input validity
Given this Markdown input:
| name | age | city |
|-------|-----|-------------|
| Alice | 30 | New York |
| Bob | 25 | Los Angeles |
The tool generates:
array(
array(
'name' => 'Alice',
'age' => '30',
'city' => 'New York'
),
array(
'name' => 'Bob',
'age' => '25',
'city' => 'Los Angeles'
)
)
Each data row becomes a nested associative array() using header values as keys
All values are wrapped in single-quoted strings
The outer structure is an indexed array of associative arrays
The output uses the classic array() syntax for maximum PHP version compatibility
With First Row as Header enabled (default), the output uses header values as associative keys. With it disabled, the output generates indexed arrays:
array(
array(
0 => 'name',
1 => 'age',
2 => 'city'
),
array(
0 => 'Alice',
1 => '30',
2 => 'New York'
),
array(
0 => 'Bob',
1 => '25',
2 => 'Los Angeles'
)
)
PHP arrays are the language's primary compound data structure. They function as ordered maps — combining the behavior of lists, dictionaries, queues, and stacks in other languages.
PHP supports two array declaration syntaxes:
// Traditional syntax (PHP 4+)
$arr = array('a', 'b', 'c');
// Short syntax (PHP 5.4+)
$arr = ['a', 'b', 'c'];
Both are equivalent. The tool outputs the traditional array() syntax for maximum compatibility.
| Function | Purpose |
|---|---|
array_column() | Extract a single column from an array of arrays |
array_map() | Apply a function to every element |
array_filter() | Remove elements that don't match a condition |
array_merge() | Combine two or more arrays |
array_keys() | Get all keys from an array |
array_values() | Get all values, re-indexing numerically |
array_unique() | Remove duplicate values |
sort() / usort() | Sort arrays by value or custom comparator |
count() | Count elements in an array |
in_array() | Check if a value exists in an array |
json_encode() | Convert array to JSON string |
Official documentation: PHP Array Types
Indexed arrays use automatic numeric keys starting from 0:
$cities = array('New York', 'Los Angeles', 'Chicago');
echo $cities[0]; // "New York"
echo $cities[1]; // "Los Angeles"
Associative arrays use named string keys:
$person = array(
'name' => 'Alice',
'age' => 30,
'city' => 'New York'
);
echo $person['name']; // "Alice"
echo $person['age']; // 30
The converter generates a structure commonly used for tabular data in PHP — an indexed outer array where each element is an associative array representing one row:
$data = array(
array('name' => 'Alice', 'age' => '30'),
array('name' => 'Bob', 'age' => '25')
);
// Access a specific cell
echo $data[0]['name']; // "Alice"
// Loop through all rows
foreach ($data as $row) {
echo $row['name'] . ' is ' . $row['age'];
}
// Extract one column
$names = array_column($data, 'name');
// ['Alice', 'Bob']
This structure is the standard format used by PDO fetchAll(), Laravel Eloquent collections, and WordPress query results.
| Scenario | Why Convert |
|---|---|
| Laravel config files | Generate config/ array files from documented settings |
| Database seeders | Create DatabaseSeeder.php arrays from spec tables |
| WordPress | Generate option arrays for themes and plugins |
| Form definitions | Convert form spec tables into validation rule arrays |
| Data fixtures | Create test data arrays for PHPUnit tests |
| Menu/navigation | Convert sitemap tables into nested array structures |
| API response mocks | Generate static response data from documented examples |
| Migration data | Move documented data into Laravel migration files |
// config/services.php
return array(
array(
'name' => 'Stripe',
'driver' => 'stripe',
'key' => 'pk_test_123'
),
array(
'name' => 'PayPal',
'driver' => 'paypal',
'key' => 'sandbox_456
')
);
// database/seeders/UserSeeder.php
$users = array(
array(
'name' => 'Alice',
'email' => '[email protected]',
'role' => 'admin'
),
array(
'name' => 'Bob',
'email' => '[email protected]',
'role' => 'editor'
)
);
foreach ($users as $user) {
DB::table('users')->insert($user);
}
// shortcode handler
$products = array(
array('sku' => 'A100', 'price' => '29.99', 'stock' => '50'),
array('sku' => 'B200', 'price' => '49.99', 'stock' => '30')
);
$output = '<table>';
foreach ($products as $product) {
$output .= '<tr>';
$output .= '<td>' . $product['sku'] . '</td>';
$output .= '<td>' . $product['price'] . '</td>';
$output .= '</tr>';
}
$output .= '</table>';
return $output;
No. All file parsing and conversion runs in your browser using JavaScript. Your data stays on your device. A.Tools never receives, stores, or transmits your file contents.
The tool supports standard pipe-delimited Markdown tables following the CommonMark specification, including tables with or without leading/trailing pipes and alignment indicators.
The tool generates an indexed array of associative arrays. Each data row becomes a nested array() with header values as keys. See the "What the Output Looks Like" section above for examples.
Yes. The generated code uses the array() syntax compatible with PHP 4 through PHP 8.x. It can be pasted directly into any .php file.
Yes. All cell values are wrapped in single-quoted strings. Use PHP type casting ((int), (float), (bool)) in your application code to convert types as needed.
array() instead of []? The traditional array() syntax is compatible with all PHP versions (4+). The short syntax [] requires PHP 5.4+. You can perform a find-and-replace to convert array( to [ and closing ) to ] if your project requires short syntax.
Yes. After parsing, the full table editor lets you modify cells, add or remove rows and columns, transpose, deduplicate, change text case, and find-and-replace values.
Processing is client-side, so the limit depends on your browser's memory. Tables with tens of thousands of rows work reliably on modern browsers.