|
@@ -40,7 +40,7 @@
|
|
|
public static function parseInt( x : String ) : Null<Int> {
|
|
|
untyped if (!__call__("is_numeric", x)) {
|
|
|
var matches = null;
|
|
|
- __call__('preg_match', '/\\d+/', x, matches);
|
|
|
+ __call__('preg_match', '/^-?\\d+/', x, matches);
|
|
|
return __call__("count", matches) == 0 ? null : __call__('intval', matches[0]);
|
|
|
} else
|
|
|
return x.substr(0, 2).toLowerCase() == "0x" ? __php__("(int) hexdec(substr($x, 2))") : __php__("intval($x)");
|