Skip to content

Instantly share code, notes, and snippets.

@superhero
Last active May 26, 2017 14:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superhero/6538507 to your computer and use it in GitHub Desktop.
Save superhero/6538507 to your computer and use it in GitHub Desktop.
Yaml
sudo apt-get install make
sudo apt-get install php5
sudo apt-get install php5-dev
sudo apt-get install php-pear
sudo apt-get install libyaml-dev
sudo pecl install yaml-1.1.0
<?php
$yaml = <<<EOD
---
invoice: 34843
date: "2001-01-23"
bill-to: &id001
given: Chris
family: Dumars
address:
lines: |-
458 Walkman Dr.
Suite #292
city: Royal Oak
state: MI
postal: 48046
ship-to: *id001
product:
- sku: BL394D
quantity: 4
description: Basketball
price: 450
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392
tax: 251.420000
total: 4443.520000
comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
...
EOD;
$parsed = yaml_parse($yaml);
print_r($parsed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment