Support binary notation.
This commit is contained in:
parent
e617ddb746
commit
78de59d0b3
@ -127,6 +127,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
array('111,222,333,444', '111,222,333,444'),
|
||||
array('1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'),
|
||||
array('foo', 'foo'),
|
||||
array(6, '0b0110'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -191,6 +191,8 @@ class XmlUtils
|
||||
return true;
|
||||
case 'false' === $lowercaseValue:
|
||||
return false;
|
||||
case strlen($value) > 2 && '0b' == $value[0].$value[1]:
|
||||
return bindec($value);
|
||||
case is_numeric($value):
|
||||
return '0x' == $value[0].$value[1] ? hexdec($value) : floatval($value);
|
||||
case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):
|
||||
|
Reference in New Issue
Block a user