spec: 2.19
yaml: |
canonical: 12345
- decimal: +12,345
octal: 014
hexadecimal: 0xC
php: |
array(
'canonical' => 12345,
- 'decimal' => 12345.0,
'octal' => 014,
'hexadecimal' => 0xC
)
---
+test: Decimal Integer
+deprecated: true
+spec: 2.19
+yaml: |
+ decimal: +12,345
+php: |
+ array(
+ 'decimal' => 12345.0,
+ )
+---
# FIX: spec shows parens around -inf and NaN
test: Floating point
spec: 2.20
yaml: |
canonical: 1.23015e+3
exponential: 12.3015e+02
- fixed: 1,230.15
negative infinity: -.inf
not a number: .NaN
float as whole number: !!float 1
array(
'canonical' => 1230.15,
'exponential' => 1230.15,
- 'fixed' => 1230.15,
'negative infinity' => log(0),
'not a number' => -log(0),
'float as whole number' => (float) 1
)
---
-test: Miscellaneous
-spec: 2.21
+test: Fixed Floating point
+deprecated: true
+spec: 2.20
yaml: |
- null: ~
- true: true
- false: false
- string: '12345'
+ fixed: 1,230.15
php: |
array(
- '' => null,
- 1 => true,
- 0 => false,
- 'string' => '12345'
+ 'fixed' => 1230.15,
)
---
test: Timestamps
todo: true
spec: 2.23
yaml: |
- not-date: !str 2002-04-28
+ not-date: !!str 2002-04-28
picture: !binary |
R0lGODlhDAAMAIQAAP//9/X
17unp5WZmZgAAAOfn515eXv
---
test: Explicit typing
+deprecated: Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0.
yaml: |
integer: 12
also int: ! "12"
- string: !str 12
+ string: !!str 12
php: |
array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
---
test: Type family under yaml.org
yaml: |
# The URI is 'tag:yaml.org,2002:str'
- - !str a Unicode string
+ - !!str a Unicode string
php: |
array( 'a Unicode string' )
---
second: 12 ## This is an integer.
- third: !str 12 ## This is a string.
+ third: !!str 12 ## This is a string.
span: this contains
six spaces
# The following scalars
# are loaded to the
# string value '1' '2'.
- - !str 12
+ - !!str 12
- '12'
- "12"
- "\
}
---
-test: Boolean
-yaml: |
- false: used as key
- logical: true
- answer: false
-php: |
- array(
- false => 'used as key',
- 'logical' => true,
- 'answer' => false
- )
----
test: Integer
yaml: |
canonical: 12345
- decimal: +12,345
octal: 014
hexadecimal: 0xC
php: |
array(
'canonical' => 12345,
- 'decimal' => 12345.0,
'octal' => 12,
'hexadecimal' => 12
)
---
+test: Decimal
+deprecated: true
+yaml: |
+ decimal: +12,345
+php: |
+ array(
+ 'decimal' => 12345.0,
+ )
+---
+test: Fixed Float
+deprecated: true
+yaml: |
+ fixed: 1,230.15
+php: |
+ array(
+ 'fixed' => 1230.15,
+ )
+---
test: Float
yaml: |
canonical: 1.23015e+3
exponential: 12.3015e+02
- fixed: 1,230.15
negative infinity: -.inf
not a number: .NaN
php: |
array(
'canonical' => 1230.15,
'exponential' => 1230.15,
- 'fixed' => 1230.15,
'negative infinity' => log(0),
'not a number' => -log(0)
)