PHP code example of neckberg / hashdown

1. Go to this page and download the library: Download neckberg/hashdown library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

neckberg / hashdown example snippets


[
  'Name of Food' => 'Twinkie',
  'Serving size' => 2 cakes,
  'Calories per serving' => 280,
]

[
  'Serving size' => [
    'Amount' => '2',
    'Unit' => 'Cakes',
  ]
]

[
  'Ingredients' => [
    'sugar',
    'water',
    'enriched flour',
  ]
]

[
  'first line,\nsecond line',
  'another list item\nwith multiple lines'
]

use Neckberg\Hashdown\Hashdown;

$x_groceries = Hashdown::x_read_file( '.../Groceries.md' );

[
  'Groceries' => [
    'Name' => 'Twinkie',
    'Ingredients' => [
      'sugar',
      'water',
      'enriched flour',
    ],
    'Name' => 'Diet Coke',
    'Ingredients' => [
      'carbonated water',
      'caramel color',
      'aspartame',
    ],
  ],
];

use Neckberg\Hashdown\Hashdown;

$x_groceries = [
  'Groceries' => [
    'Name' => 'Twinkie',
    'Ingredients' => [
      'sugar',
      'water',
      'enriched flour',
    ],
    'Name' => 'Diet Coke',
    'Ingredients' => [
      'carbonated water',
      'caramel color',
      'aspartame',
    ],
  ],
];
Hashdown::write_to_file($x_groceries, '.../Groceries.md');

Hashdown::write_to_file($x_groceries, '.../Groceries.md', false, true);

Hashdown::write_to_file($x_groceries, '.../Groceries.md', true, false);

Hashdown::write_to_file($x_groceries, '.../Groceries.md', false, false);